stereo images - baseline, units, depth map generation...

asked 2016-11-20 09:03:30 -0500

Hendrik Wiese gravatar image

updated 2016-11-21 03:15:32 -0500

Hey everyone,

I'm trying to get elas_ros to generate a depth map and a point cloud. I can successfully generate a disparity map which reflects the disparity between the two stereo images pretty well. However my depth map is - at least in the areas where I get a valid disparity map - always entirely black.

The thing is... I don't use an actual stereo camera to produce the /stereo/left and /stereo/right channels but instead I'm using a mono camera which is moved along the base line by a stepper motor. So I take the left image, move the camera and take the right image. After that I start publishing both images together with the camera_info (generated by calibrating the monocular camera using the provided calibration tools) on the corresponding /stereo/left and stereo/right channels. Like mentioned, this works pretty well for generating the disparity map.

But there has to be something missing that I overlook. I suppose elas_ros does need some info about the baseline. I'm not sure how to provide that info.

So I guess the actual question is... well, are:

  1. how do I tell elas_ros the necessary information about the simulated stereo camera that is not provided by a monocular camera calibration?
  2. What do I have to change in the monocular calibration data (called ost.yaml in my case) to be treated like a stereo camera?
  3. aside from the baseline length (i.e. the distance the camera moves between the two shots) what other additional information do I have to provide under this circumstances to generate a valid point cloud?


Update 1

I figured that I have to incorporate the baseline length B in the P matrix of the CameraInfo message of the right pseudo-camera in the following way:

P[3] = Tx = -fx' * B

This works to some extent... but the latest question is now: what's the unit of the baseline B? Is it millimeters? Meters? Inches?

Update 2

Since fx' appears to be in pixels, I've tried to use a baseline in pixels instead of mm by calculating the sensor size in mm (datasheet says it's a 1/2.5" = 10.16mm sensor and I just assumed that it's the diagonal length, so to calculate the side length a just solve the equation system: a^2+b^2 = 10.16mm; a/b = 16/9; a = 2.78) and using that value to switch from baseline in mm to baseline in pixels like

B_px = B_mm * sx_px / sx_mm
P[3] = Tx = -fx' * B_px

Using that baseline_px value I get a depth map, but it's values are totally out of range. I'm really struggling with the units here.

__Could anybody please tell me what the units are that I have to work with to get this running?__


edit retag flag offensive close merge delete