简体   繁体   中英

Do I need to convert my intrinsic parameters after finding them in camera calibration (openCV)

I am building a robot that needs to know its trajectory using a monocular camera.

I have calibrated my camera using openCV and received its intrinsic parameters. I have followed this tutorial .

One thing I don't understand is the units of his plots, how did he manage to get to meters?

I have read his code here and there is nothing to do with unit converting. He claims to get his units to meters.

I rewrote most of the code, and all my plots are very disoriented. When I test it and walk 1 meter, it can say that I walked 8 meters.

I have received my intrinsic parameters in pixels from the calibration, I found the focal length in mm and the pixel size in micro meters from the raspberry pi cam site .

I think I need to convert my intrinsic parameters to meters using these two. Can't find documentation about this anywhere. would that solve my problem?

distance (in meters) = (focal length (in mm) * object size (in pixels)) / (object size (in pixels) * pixel size (in um))

For example, if you have an object that is 50 pixels wide and the focal length of your camera is 5 mm and the pixel size of your camera is 0.0026 mm (2.6um), you can calculate the physical width of the object as follows: (5 * 50) / (50 * 2.6 * 10^-6) = 0.96 meters

Keep in mind that this equation assumes that the camera is not tilted or rotated with respect to the object, and it also assumes that the object is at a fixed distance from the camera. If either of these conditions is not met, additional calculations are required.

This link could be useful for you too: https://www.scantips.com/lights/subjectdistance.html

All the units in the camera matrix are in pixels, also the focal length. The only calibration parameter that is in world units is the baseline (meters or mm, or whatever unit you may use).

So, where the baseline comes from? Well, when doing calibration with a chessboard, for example, you are usually asked to set the square size . Here is you chance to set it in world units (eg mm). An example is here .

Note that you may also leave it to 1 to get adimensional 3D reconstruction. This is probably why you are getting non-corresponding distances.

In your situation, you may also avoid to recalibrate by rescaling the baseline by the appropriate factor. Good luck!

Note Pixel focal length is obtained by dividing the physical focal length (mm) by the real pixel size (mm).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM