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!

 採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2021 年 9 月 27 日

0 投票

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 件のコメント

Thank you for your answer. However, I am not sure if I got it right. I mean, what do you think should I do to overcome this problem? Please note that I have hundreds of thousands of images, which I need to be processed in MATLAB automatically, so using an external software would not be a good idea.
Thanks
Bjorn Gustavsson
Bjorn Gustavsson 2021 年 9 月 27 日
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...
Thank you for your fast reply. Good tip. The next step is to detect Harris corners. If I use the raw undistorted image, the most powerful corners would always locate at the black border (due to high intensity difference between dark and bright pixels of the border). Therefore, I think the best measure to take is to crop the undistorted image. Appreciate your consideration!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で MATLAB Support Package for USB Webcams についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by