Camera Calibration with OpenCV

This post is about distortions and to undistort them and calibrating your camera with matrices.

OpenCV has many great weapons in it’s own arsenal one of them is calib3d. My intent is to share a block of code and explain it to you. May be I feed this post with my own repository for you.

I’m listing general steps in my own flow:

  • Printing a chessboard image is a must.
  • You should also get a ruler and measure dimension of a square from your chessboard for the code.
  • After that also don’t forget size of your chessboard. Size and edge sizes are important for your camera parameters to calibrate.
  • Get size of your chessboard too for your code!
  • Taking several pictures of your chessboard. Whole chessboard has to be captured into images.
  • Running the calibration code and get your camera and distortion matrices 🙂
Getting images to calibrate my camera 🙂

Here is chessboard sample code of OpenCV it’s in C++, the original code that I’ve worked and improved on. Here is my GitHub project. In this project:

  • You can create your own chessboard image with desired size, desired pixel size.
  • Save chessboard image
  • Set Camera FPS and Resolution
  • Grab images from your webcam
  • Start Calibration

Projects is ready to use to calibrate your camera 🙂 System Requirements are:

  • OpenCV 3
  • QT 5.13 at least
  • and a compiler 😀

Enjoy!
Your calibration data will be saved under /data directory.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *