Getting real depth from a mismatch card

I want to get the real distance from the subject from the stereo camera. I am using the OpenCV sample code as described in Learning OpenCV O'Reilly. After receiving the non-conformance map, I want to use the formula:

distance = focal_length * base distance / mismatch

The problem is this:

  • I get negative values ​​of inequalities. How to convert these values ​​so that they can be used in calculating the actual depth?

  • In the above formula, the focal length and base distance are in mm (returned by the repeat matrix), while the difference will be in pixels. Thus, the result will be in mm ^ 2 / pixel. How to convert inequality value from pixel to mm.

+4
source share
4 answers

You can use CVs correlation features such as Stereo Block matching or Semi Global Block Matching. This will give you a map of inconsistencies for the entire image, which can be converted to 3D points using a Q matrix (cv :: repjectImageTo3D).

0
source

There are two problems here:

  1. Units. Assuming your cameras are calibrated, you have a focal length in pixels , so the disparity unit is in mm or any other metric unit. See my answer to the same question here .

  2. , 3D , . , . .

0

, , .

, ( , ), . ( ), , :

depth = baseline * focal / disparity
0

A simple formula for converting inequalities to distances is written for the case of parallel cameras and with differences expressed in metric units (mm, in your case).

In practice, using OpenCV and assuming your stereo is calibrated, you will perform tight triangulation using a procedure like reprojectImageTo3D

-1
source

Source: https://habr.com/ru/post/1536303/


All Articles