I used sample code that comes with opencv to calibrate my laptop web cam.

I created around 82 images from a chessboard and used the code to process them.

The result is as follow:

This is a camera calibration sample.
Usage: calibration configurationFile
Near the sample file you'll find the configuration file, which has detailed help
of how to edit it.  It may be any OpenCV supported file format XML/YAML.
Re-projection error reported by calibrateCamera: 0.424482
Calibration succeeded. avg re projection error = 0.424483

|It seems that the avg projection error is the same as before. Why this is happening?

How can I create a map to convert an un-calibrated image to a calibrated one?

有帮助吗?

解决方案

The calibration tool should have generated a XML/YML file where it stored the camera coefficients K and distortion coefficients D. You can load these coefficients using the cv::FileStorage class (documentation link). This tutorial explains how to use this class.

Once you have the calibration data (matrix K and distortion coefficients D), you can use the undistort function (documentation link) to generate an ideal image where lens distortion was corrected.

Related to your second question, the two numbers displayed in the console are both estimations of the reprojection error after the calibration, one reported at the end of the calibration procedure, and the second reported by the calibration sample executable.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top