Camera Calibration Program Made A Bit Easier

For teams looking to use openCV or some other form of computer vision. calibration camera files can be a pain. Here’s a program I made to make it a bit easier to do it, so you can get right to programming.

Nice program. However, I have some comments.

  1. You should calibrate the camera at the same resolution you will be using on the robot. Most teams (I think) use resolutions like 320x240 or 424x240.

  2. In my experience, a lot of images do not actually work. The image might be blurred. Or maybe the chessboard is at a funny angle. Whatever the reason, findChessboardCorners() may not accurately find the set of corners, resulting in a bad calibration. I strongly recommend using a collection of images on disk and making a first pass to check that the corners are found correctly.

  3. You are limiting it to 20 images. That is OK, but it does not hurt to get more.

  4. you can get a little more precise results if you refine the corners with cornerSubPix(). See https://docs.opencv.org/3.1.0/dc/dbb/tutorial_py_calibration.html.

  5. you have assumed that the chessboard squares are 1.0 inch on a side. You might want to make that explicit.

  6. you have imported matplotlib and pyplot, but I don’t those are used at all.

If you are interested, I too wrote calibration utility. You can see it here: https://github.com/ligerbots/VisionServer/blob/master/utils/camera_calibration.py

1 Like

Thanks for the feedback. The reason I don’t use a smaller resolution is in whatever program runs the actual vision software, I scale the values in the matrix based on the size of the image used for the calibration and the size of the image for vision input.