imagemagick - Correct barrel distortion in OpenCV manually, without chessboard image -


I get images from the camera where it is not possible to take a chess picture and calculate correction matrix using OpenCVI. So far, I have corrected the images using the ImageMagic Converter, change the "Distinct Barrels" option with 0.0 0.0 -0.035 1.1 "'where I got the parameter with the test and error.

Now I I want to do this in OpenCV but all I find on the web is automatic improvements using chess image. Do I have any chance to implement some simple manual trial and error lens distortion correction What did I do with the image map?

OK, I think I got matrix cam 1 In, the cam2 image center was disappearing (see the documentation). I added it and changed the focal length to avoid a very strong change of the image size. Here is the code:

  import As NMP import cv2 src = cv2.imread ("deformed image .jpg") width = SRC. [1] height = src.shape [0] distCoeff = np.zeros ((4,1), np.float64 ) # TODO: y Yes add your coefficient! K1 = -1.0e-5; # negative to remove barrel distortion k2 = 0.0; P1 = 0.0; P2 = 0.0; DistCoeff [0,0] = K1; Distress coof [1,0] = K2; Distoch [2,0] = P1; Distoch [3,0] = P2; Consider the unit matrix for # camera camera = npee IE (3, dtype = np.float32) cam [0,2] = width / 2.0 # Define center x camera [1,2] = height / 2.0 # Center U camera [0,0] = 10. # Defines the focal length camera [1] = 10. # defines the focal length # here to countless to DST = CV 2.Undustort (Scom, CAM, Dist.COOF) CV 2. Imsho ('


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -