We are using ArUco markers to calculate the real-world size of objects in an image. Here's a sample test image:
I find the outer corners of the ArUco markers and use warpPerspective
to move the board's plane perpendicular to the camera's:
We've found that we aren't achieving the accuracy we were expecting. (It's hard to tell in these small images, but the sizes of the squares in the grid aren't completely consistent.) We thought that calibrating the camera might help with accuracy so we calibrated using these pictures of a ChArUco board. We modified the calibrate_camera_charuco program to use a collection of still images instead of images captured from a video, but it's otherwise identical.
But instead of eliminating distortion as we expected, calling undistort
with the calibration values introduces barrel distortion. Here's the same original image after running it through undistort
:
You can see that the straight edges in the lower-left corner of the board are curved.
My question is why does calibration introduce distortion? Is calibration for some different use case instead of making images more accurate by eliminating distortion as we're assuming?