Wrong distortion parameters in camera calibration
6 views (last 30 days)
Show older comments
Mohammad Hussein Yoosefian Nooshabadi
on 27 Sep 2021
Commented: Mohammad Hussein Yoosefian Nooshabadi
on 27 Sep 2021
Hi,
Hope you are doing well. I have calibrated my Raspberry Pi V2 camera using single camera calibrator app in MATLAB. I tried to do everything as per instructions provided here. However, the distortion parameters seem to be incorrect, since when I apply these distortion parameters (i.e., try to undistort the images using
undistortImage
), the image gets cropped and surrounded by barrel-like black borders. For clarification, I have attached a sample image before and after being undistorted.
Ideas are much appreciated!
0 Comments
Accepted Answer
Bjorn Gustavsson
on 27 Sep 2021
After quickly looking at the amount of distortion noticeable it seems pretty small - open the images in gimp (for example, comercial software also available) and add lines to the edge of the table on the left it is perhaps a small difference corrected for in the undistorted version, but at this resolution it is difficult to tell (you might have raw-images with higher resolution). When I try to image the difference between the grayscale version (gIm1 = double(rgb2gray(Im1))); etc) it is still difficult to tell. The undistortion is just a re-interpolation of the image as it would've been captured with an ideal plain pin-hole camera (no half-spherical beads only the pin-hole). Therefore, for pincushion-distortion images the lines-of-sight along edges of the ideal plain pinhole-cameras fall outside the field-of-view of pincushion-distorting optics, and the image intensities of the corresponding pixels are set to zero.
HTH.
3 Comments
Bjorn Gustavsson
on 27 Sep 2021
This is a "problem" only in the sense that you get some very dark pixels along the edges (for pincushion distortion) or in the corners (for barrel distortion). This is a direct consequence of an absolute lack of information about what is outside the field-of-view. In the words of Wittgenstein what we know nothing of we should not show - therefore the black. If the black parts bother you you could always crop them out, I guess. What you need to do after the "undistortion" depends on what you want to do next with the images and what is required for that, since I don't know what's next it is difficult to give you advice...
More Answers (0)
See Also
Categories
Find more on Camera Calibration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!