Ask Your Question

mannyglover's profile - activity

2019-02-28 21:50:29 -0600 received badge  Nice Answer (source)
2018-11-15 16:49:17 -0600 edited answer What does the getOptimalNewCameraMatrix function does?

Consider the image above. It has been undistorted. Lines that are straight in 3D space are now straight in the 2D pr

2018-07-24 20:49:42 -0600 answered a question Convert pixel position to world direction?

You could use cv::triangulatePoints().

2018-07-18 14:36:42 -0600 received badge  Teacher (source)
2018-07-10 19:57:22 -0600 received badge  Necromancer (source)
2018-07-10 13:54:09 -0600 answered a question OpenCV camera_calibration sample. No input found.

I had this same issue. I solved it by including the camera index in quotes: changing <Input>0</Input> to &l

2018-07-10 13:31:07 -0600 received badge  Enthusiast
2018-06-15 13:01:57 -0600 commented answer Why is there an opencv2 folder inside OpenCV 3.x?

Cool. Thank you.

2018-06-15 11:10:09 -0600 asked a question Why is there an opencv2 folder inside OpenCV 3.x?

Why is there an opencv2 folder inside OpenCV 3.x? Is this just for backwards compatibility, for people who have been dev

2018-06-14 16:36:40 -0600 answered a question ximgproc in opencv2 file not found

Just for clarity, after you clone opencv contrib as @LBerger recommended, you have to rebuild opencv with the -D OPENCV_

2017-05-09 15:04:59 -0600 commented question OpenCV 3.2 includes libmirprotobuf and protobuf 2.6 which is conflicting with protobuf 3.1

I'm having a similar issue with Qt and protobuf. If I find the answer, I will post it here.

2017-01-17 15:25:27 -0600 answered a question Basic FileStorage operation problem - failed to open:

Maybe the place where the binary is running is not the place where the configuration file is. Try giving in absolute path to the configuration file as the command-line argument.

2017-01-17 15:20:16 -0600 commented question Valid XML should start with '<?xml ...?>' in function icvXMLParse

I'm getting the same error. It works fine with an xml file, but in order to be consistent with the other part of our system, I needed to read in the data in yaml format. I do the same thing as you, and get the same error :-( It's trying to read it as an xml though it's supposed to know it's yaml from the extension!

2016-12-22 20:53:55 -0600 received badge  Necromancer (source)
2016-12-22 16:24:36 -0600 commented question horrible calibration results

See this http://answers.opencv.org/question/28... question and answer and the comments too. I was able to "solve" this problem and get consistently good results by zooming in. It seems that the extreme radial distortion is the culprit. Also, I started using a rig to have my chessboard stable for every shot. I'm not sure if this made a big difference did, but I know that decreasing the radial distortion by zooming definitely did.

2016-12-22 16:15:38 -0600 answered a question What does the getOptimalNewCameraMatrix function does?

Undistorted image lots of black

Consider the image above. It has been undistorted. Lines that are straight in 3D space are now straight in the 2D projection (the 2D image). Radial distortion has been removed. But what's up with the "four pointed star" shape? This is because in order to correct for radial distortion, pixels that are further away from the center of distortion must get pushed more than pixels closer to the center of distortion. See the picture below:

image description

The red dots represent pixel locations before undistorting: they follow a regular grid. But the radial distortion model says that as one moves away from center of distortion, the distortion gets worse. It is called a radial distortion model because this is a function of the size of the radius of a circle centered around the center of distortion. The heads of the blue vectors represent where the red pixels will get undistorted to. Since the original image is a rectangle, the points toward the corners have the highest radius, and they must get pushed out more. But if you want to see every pixel from the original image, this means you will have the black "hills" on the sides of the undistorted image. If you don't want to see these black hills, set alpha to 0. If you do want to see these black hills, set alpha to 1. If you want to see the black hills, but you want them to be smaller, set alpha to 0.5. You get the picture.

2016-12-22 15:43:18 -0600 commented answer Problem with getOptimalNewCameraMatrix

@Hilman, @Tetragramm, Check out this question and answer at http://answers.opencv.org/question/28... .

2016-11-17 09:29:40 -0600 commented answer Undistortion at far edges of image

For me, I was able to "solve" the problem simply by zooming in. The "fish bowl" effect of radial distortion is most pronounced near the edges of the field-of-view, so by zooming in, you are effectively "cropping" your image and thereby reducing the extreme radial distortion. This may not be practical for your application, if you require the widest angle possible, or if your camera doesn't have zoom, but it worked for me! (I wouldn't have thought of this solution if it weren't for this answer, where you noted that these deficiencies in the algorithm are only apparent with cameras with strong radial distortion, so thanks @jensenb!)

2016-11-17 09:20:36 -0600 commented answer Bad Camera Calibration

@berak, I edited the answer so that it is now more proper, because I found a solution.

2016-11-17 08:54:14 -0600 commented answer Bad Camera Calibration

@berak True, okay, I'll change it.

2016-11-16 09:59:50 -0600 answered a question Bad Camera Calibration

I was having the same problem. I calibrated over and over again, but couldn't get any results better than the image you linked to, and sometimes worse. I read this question and answer from elsewhere on the site, and it helped me solve my problem. In the link, you will see that the person answering the question writes that the problem is related to deficiencies in a couple of OpenCV functions that only become apparent when dealing with cameras with strong radial distortion. For me, I was able to "solve" the problem simply by zooming in. The "fish bowl" effect of radial distortion is most pronounced near the edges of the field-of-view, so by zooming in, you are effectively "cropping" your image and thereby reducing the extreme radial distortion. This may not be practical for your application, if you require the widest angle possible, or if your camera doesn't have zoom, but it worked for me!

2016-11-15 09:44:59 -0600 received badge  Editor (source)
2016-11-15 09:44:30 -0600 answered a question OpenCV Error: Bad argument (Unknown array type) in cvarrToMat

Switch length and width. I ended up just switching the length and width numbers in the input xml file, and it ended up working. Initially, I was getting a funky undistorted image, but I set all the following constraints to zero (false):

  <!-- Consider only fy as a free parameter, the ratio fx/fy stays the same as in the input cameraMatrix.
           Use or not setting. 0 - False Non-Zero - True-->
  <Calibrate_FixAspectRatio> 1 </Calibrate_FixAspectRatio>
  <!-- If true (non-zero) tangential distortion coefficients  are set to zeros and stay zero.-->
  <Calibrate_AssumeZeroTangentialDistortion>1</Calibrate_AssumeZeroTangentialDistortion>
  <!-- If true (non-zero) the principal point is not changed during the global optimization.-->
  <Calibrate_FixPrincipalPointAtTheCenter> 1 </Calibrate_FixPrincipalPointAtTheCenter>

and then it worked correctly.

2016-11-15 09:41:23 -0600 answered a question Problem with OpenCV calibration module

Switch length and width. I ended up just switching the length and width numbers in the input xml file, and it ended up working. Initially, I was getting a funky undistorted image, but I set all the following constraints to zero (false):

  <!-- Consider only fy as a free parameter, the ratio fx/fy stays the same as in the input cameraMatrix.
           Use or not setting. 0 - False Non-Zero - True-->
  <Calibrate_FixAspectRatio> 1 </Calibrate_FixAspectRatio>
  <!-- If true (non-zero) tangential distortion coefficients  are set to zeros and stay zero.-->
  <Calibrate_AssumeZeroTangentialDistortion>1</Calibrate_AssumeZeroTangentialDistortion>
  <!-- If true (non-zero) the principal point is not changed during the global optimization.-->
  <Calibrate_FixPrincipalPointAtTheCenter> 1 </Calibrate_FixPrincipalPointAtTheCenter>

and then it worked correctly.

2016-11-14 18:15:18 -0600 commented question OpenCV Error: Bad argument (Unknown array type) in cvarrToMat

I am also having the same problem :( I am using an 11x4 asymmetric circles grid. No clue what's going wrong.

2016-11-14 15:36:18 -0600 received badge  Supporter (source)