Take the 2-minute tour ×

I need your help. I have implemented stereo calibration, rectification using my stereo pair. I have got a disparity image which is quite reasonable. The problem that I face is with cvReprojectImageTo3D.I have used stereobM. And rectified in a correct way. Declaration is as follows

 CvMat* disp = cvCreateMat( imageSize.height, imageSize.width, CV_16S );
 CvMat* vdisp = cvCreateMat( imageSize.height,imageSize.width, CV_8U );
 CvMat* Image3D = cvCreateMat(imageSize.height, imageSize.width, CV_32FC3);   

disp is disparity image obtained for the stereo pair.And when I run the command of showimage of Image3D I obtain colorful divisions. My doubt is why this is so. I attach the link of my result
photo is given below


Another doubt I have is how this image3D is stored. Does CV_32FC3 mean that first channel gives x value second gives y and third gives z or sort of or Is there any other representation..?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Yes, " Output 3-channel floating-point image of the same size as disparity . Each element of _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity map."

So it's the floating pointing x,y,z at each pixel coordinate

see http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html

share|improve this answer
there is also another question based on photo that I have attached..Could you please give me the explanation why image consists of 4 colors –  nbsrujan Jun 1 '12 at 16:42
what can we derive from these colors? –  nbsrujan Jun 1 '12 at 16:49
@nbsrujan - you aren't supposed to display the 3D image, it's not really an image. It just uses the image format for convenience to reuse all the memory handling, I/O etc code –  Martin Beckett Jun 1 '12 at 16:50
en.wikipedia.org/wiki/YCbCr this link arises doubts in me.. –  nbsrujan Jun 1 '12 at 16:52
@nbsrujan - it's nothing to do with YCbCr, the four colors are simply where the floating point x,y values change from -ve to +ve or wrap around 255 or something, it's just an artifact of how the display handles a floating point image. Print the values of the array out and look at them –  Martin Beckett Jun 1 '12 at 16:58
show 1 more comment

did you try something like

cvSave("depthmeasure.txt", Image3D);

share|improve this answer
add comment

Your Answer


