OpenCV camera image calibration to remove barrel distortion

I have an Amcrest IP8M-2496EB-40MM PoE IP camera (3840x2160 image, 4.0mm narrower angle lens) that I use for weather time-lapse videos. I have it mounted outside.

One issue: Even with the “narrow angle lens” version there is considerable barrel distortion in the image.

OpenCV can calculate calibration parameters to undistort wide angle (or any pinhole) cameras. I performed OpenCV’s chessboard calibration on this Amcrest. The normally barrel shaped distortion is removed with a small loss in FoV, a good compromise. The result is a nice high-resolution image that is distortion free, which I use for weather time-lapse videos.

If you happen to have the same Amcrest model, opencv-utilities/camcalibrate.py at main · idatum/opencv-utilities (github.com)) has calibration parameters for the Amcrest IP8M-2496EB-40MM and a simple example of how to undistort.

There’s a video demonstrating the chessboard calibration in the OpenCV documentation if you want to do this yourself: Camera calibration with square chessboard

What I also like about this Amcrest model is there is no “cloud” BS – it integrates locally to HA. I can configure any settings needed by connecting directly to the camera’s web interface (no app needed).

1 Like