How to create a depth map from PointGrey BumbleBee2 stereo camera using Triclops and FlyCapture SDKs?

StackOverflow https://stackoverflow.com/questions/21775081

  •  11-10-2022
  •  | 
  •  

Question

I've got the BumbleBee 2 stereo camera and two mentioned SDKs.

I've managed to capture a video from it in my program, rectify stereo images and get a disparity map. Next thing I'd like to have is a depth map similar to one, the Kinect gives.

The Triclops' documentation is rather short, it only references functions, without typical workflow description. The workflow is described in examples.

Up to now I've found 2 relevant functions: family of triclopsRCDxxToXYZ() functions and triclopsExtractImage3d() function.

Functions from the first family calculate x, y and z coordinate for a single pixel. Z coordinate perfectly corresponds to the depth in meters. However, to use this function I should create two nested loops, as shown in the stereo3dpoints example. That gives too much overhead, because each call returns two more coordinates.

The second function, triclopsExtractImage3d(), always returns error TriclopsErrorInvalidParameter. The documentation says only that "there is a geometry mismatch between the context and the TriclopsImage3d", which is not clear for me.

Examples of Triclops 3.3.1 SDK do not show how to use it. Google brings example from Triclops SDK 3.2, which is absent in 3.3.1.

I've tried adding lines 253-273 from the link above to current stereo3dpoints - got that error.

Does anyone have an experience with it?

Is it valid to use triclopsExtractImage3d() or is it obsolete?

I also tried plotting values of disparity vs. z, obtained from triclopsRCDxxToXYZ().

The plot shows almost exact inverse proportionality: enter image description here.

That is z = k / disparity. But k is not constant across the image, it varies from approximately 2.5e-5 to 1.4e-3, that is two orders of magnitude. Therefore, it is incorrect to calculate this value once and use forever.

Was it helpful?

Solution

Maybe it is a bit to late and you figured it out by yourself but:

To use triclopsExtractImage3d you have to create a 3dImage first.

TriclopsImage3d *depthImage;
triclopsCreateImage3d(triclopsContext, &depthImage);
triclopsExtractImage3d(triclopsContext, depthImage);
triclopsDestroyImage3d(&depthImage);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top