Vacatronics

Electronic, robotics, programming, IoT, and other cool stuffs.

Follow publication

3 Ways To Calibrate Your Camera Using OpenCV and Python

Fix camera distortions in an easy way.

Fernando Souza
Vacatronics
Published in
7 min readMar 29, 2021

Photo by Ameen ALmayuf on Unsplash.

When a camera takes a photograph, we often see the image not quite the same as we see it in our brain. This is caused by the camera lens and it happens more than we think.

This alteration of the image is what we call distortion.

Generally speaking, distortion is when a straight lines appear bent or curvy in an image.

There are different types of distortion, depending essentially on the model of the camera lens you used.

Different types of distortion.

Although you sometimes want to create a nice effect on your images, a distortion can be bad for computer vision systems. Since the coordinates of the image are deviated from its original position, you might create some errors or fail to detect an object.

When you calibrate a camera, you discover some specific parameters that will fix these distortions.

Camera Model

Source: here.

A camera model describes a relationship between a point in a 3D space and its projection into a 2D space (an image). The pinhole camera model is often used in computer vision as a reasonable approximation of a camera.

Duration the calibration process, some parameters are discovered to fix most of the distortions caused by a camera:

  • Intrinsic parameters: focal length, optical center, and skew coefficients. Specific to each camera.
  • Extrinsic parameters: rotation and translation vectors that translate a 3D scene into a 2D coordinate.
  • Radial distortion coefficients: it models the radial distortion, that causes straight line to appear curved. It occurs when light rays bend more near the edges of a lens than they do at its optical center.
  • Tangential distortion coefficients: it models the…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Vacatronics

Published in Vacatronics

Electronic, robotics, programming, IoT, and other cool stuffs.

Fernando Souza

Written by Fernando Souza

Enthusiast of programming, electronics, technology and beer, not necessarily in that order. BuyMeACoffee: buymeacoffee.com/ustropo

Responses (1)

Write a response

Thanks for these tips!