Camera calibration with OpenCV
In this section, you will learn how to take objects with a known pattern and use them to correct lens distortion using OpenCV.
Remember the lens distortion we talked about in the previous section? You need to correct this to ensure you accurately locate where objects are relative to your vehicle. It does you no good to see an object if you don't know whether it is in front of you or next to you. Even good lenses can distort the image, and this is particularly true for wide-angle lenses. Luckily, OpenCV provides a mechanism to detect this distortion and correct it!
The idea is to take pictures of a chessboard, so OpenCV can use this high-contrast pattern to detect the position of the points and compute the distortion based on the difference between the expected image and the recorded one.
You need to provide several pictures at different orientations. It might take some experiments to find a good set of pictures, but 10 to 20 images should...