Ask Your Question

Calculate distance based on stereo vision

asked 2017-01-13 00:55:26 -0500

hoang anh tuan gravatar image

updated 2017-01-13 02:10:35 -0500

I am studying about a problem what the distance from the camera to the object. I intend to resolve it by below method:

  1. Get images from 2 cameras and then convert them to grayscale images.

  2. Use cv::StereoBM to create disparity map.

  3. Calculate distance from disparity map.

Is my resolution right? Is it necessary to calibrate the camera(from information in the Internet)? I don’t know why and when I must use it.

P/s: By the way how is the step 3 above?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2017-01-13 04:01:50 -0500

Eduardo gravatar image

updated 2017-01-13 04:05:31 -0500

You have to calibrate the stereo cameras and also undistort and rectify the images before doing the stereo matching. Once you have calibrated the cameras, you must not move or change the camera configuration (of course you can move the stereo rig) otherwise you will have to calibrate again.

Take a look at the samples (OpenCV 3.2):

edit flag offensive delete link more


I want to know the result of calibrating the stereo cameras. Can you help/explain me? Tks bro

hoang anh tuan gravatar imagehoang anh tuan ( 2017-01-15 20:29:56 -0500 )edit

Question Tools

1 follower


Asked: 2017-01-13 00:55:26 -0500

Seen: 1,948 times

Last updated: Jan 13 '17