Ask Your Question

Camera calibration

asked 2013-03-04 15:31:42 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

Hi Is there any example for camera calibration using opencv2.4.3. I have found that i can do the camera calibration of my device by saving a set of images to sdcard, then copy them to desktop and run C++ calibration sample:Take some pictures of the calibration template ,use the calibration c++ example: ./calibration -h 11 -w 4 -o camera.yml -pt acircles -oe image_list1.xml copy the .yml file to your phone and reuse the camera matrix and distortion coefficients. I wonder can i calibrate the camera of my device like that? Does the calibration depend on the camera intrinsic parameters? Really i need it as soon as possible. Thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-03-05 01:24:23 -0500

Yes you could do that!

The pictures taken from the phone camera are ''distorted'' by the lenses and the focal of your camera. You definitively could take picture/video directly from your phone and calibrate with a PC tool. I think this is the best way to do this.

If you need to calibrate any phone device directly with your application, it will be very slow! Consider taken pictures (possibly with the android build-in camera application) and perform calibration with a native call to OpenCV but offline due to the time requested by such computation.

edit flag offensive delete link more


thank you Mathieu.i have done the camera calibration on desktop,now i wanna reuse it on my phone. Do you have any idea how can i reuse the camera matrix and distortion coefficients?

pocahentez gravatar imagepocahentez ( 2013-03-06 05:45:06 -0500 )edit

The same way as in PC, with OpenCV functions (see remap in the doc). Maybe, if you don't want to support any other devices, you could directly hard code the values instead of loading an XML file.

Mathieu Barnachon gravatar imageMathieu Barnachon ( 2013-03-06 08:46:19 -0500 )edit

I can't understand anything. can you please explain in more details. I generated an xml file to reused on my code. I'm looking to overlay a 3D model in a streaming from a live video.I'm working on android platforme.

pocahentez gravatar imagepocahentez ( 2013-03-06 10:17:04 -0500 )edit

On what part did you need more explanation ? If it was calibration, read carefully the tutorial ( specially part 5 of Explanation section which relies on rectification of images. As said before (to the best of my knowledge) is should work either on PC and Android.

Mathieu Barnachon gravatar imageMathieu Barnachon ( 2013-03-06 10:25:51 -0500 )edit

can you suggest a flow for calibrating android camera, through an android application. In certain application use cases, 1st time camera calibration is necessary. Thanks in advance !

utkarshmankad gravatar imageutkarshmankad ( 2013-04-07 03:26:44 -0500 )edit

The workflow is the same as in PC: 1) capture images of a chessboard 2) compute intrinsic parameters with findIntrinsic function 3) compute map of distortion, and remap original images. If you need extrinsic, after computing intrinsic, use findExtrinsic function.

But your solution will be very slow on Android, I've tested this solution on Samsung Note, and it's to slow to be really interesting. Maybe you should investigate a simpler calibration function, specially design for smartphone.

Mathieu Barnachon gravatar imageMathieu Barnachon ( 2013-04-08 02:01:50 -0500 )edit

thanks Mathieu for sharing your experience regarding Android camera calibration. I am breaking my head on this problem since last few days, trying to write an Android application for Samsung Note, to calibrate its camera. The module is supposed to fit into an AR application, where distortion parameters of the camera are inevitable. Using the camera as webcam and then calibrating it, using a desktop application is a stopgap solution (since the developer like can do that), but for a crash free application development, need to look for better solutions. Also, different Android devices having different camera make, the distortion parameters might change. Many many thanks :)

utkarshmankad gravatar imageutkarshmankad ( 2013-04-08 07:56:55 -0500 )edit

Question Tools


Asked: 2013-03-04 15:31:42 -0500

Seen: 2,346 times

Last updated: Mar 05 '13