# Revision history [back]

### depth estimation

I am using stereocalibrate and stereorectify to get the Q matrix. I am giving this as input to cv.ReprojectImageto3D to get the depth map. But when I try to show the results, many values are calculated as infinity.

Do I need to change or scale anything before reprojecting. And is the result which we get in pixels?

(roi1,roi2) = cv.StereoRectify(camMatrix1, camMatrix2, d1, d2,(320,240), r, t, r1, r2, p1, p2, q, cv.CV_CALIB_ZERO_DISPARITY, -1, (0, 0))
np.savetxt('Q_mat.txt',q)
disparity  = getDisparity(img_r, img_l, "BM")
disp = cv.fromarray(disparity)
Image = cv.CreateMat(disp.rows, disp.cols, cv.CV_32FC3)
Q = np.reshape(Q,(4,4))
Q1 = cv.fromarray(Q)
cv.ReprojectImageTo3D(disp, Image, Q1, 0)


### depth estimationopencv ReprojectImageto3D gives values tending to infinity

I am using stereocalibrate and stereorectify to get the Q matrix. I am giving this as input to cv.ReprojectImageto3D to get the depth map. But when I try to show the results, many values are calculated as infinity.

Do I need to change or scale anything before reprojecting. And is the result which we get in pixels?

(roi1,roi2) = cv.StereoRectify(camMatrix1, camMatrix2, d1, d2,(320,240), r, t, r1, r2, p1, p2, q, cv.CV_CALIB_ZERO_DISPARITY, -1, (0, 0))
np.savetxt('Q_mat.txt',q)
disparity  = getDisparity(img_r, img_l, "BM")
disp = cv.fromarray(disparity)
Image = cv.CreateMat(disp.rows, disp.cols, cv.CV_32FC3)
Q = np.reshape(Q,(4,4))
Q1 = cv.fromarray(Q)
cv.ReprojectImageTo3D(disp, Image, Q1, 0)


 3 retagged berak 32993 ●7 ●81 ●312

### opencv ReprojectImageto3D gives values tending to infinity

I am using stereocalibrate and stereorectify to get the Q matrix. I am giving this as input to cv.ReprojectImageto3D to get the depth map. But when I try to show the results, many values are calculated as infinity.

Do I need to change or scale anything before reprojecting. And is the result which we get in pixels?

(roi1,roi2) = cv.StereoRectify(camMatrix1, camMatrix2, d1, d2,(320,240), r, t, r1, r2, p1, p2, q, cv.CV_CALIB_ZERO_DISPARITY, -1, (0, 0))
np.savetxt('Q_mat.txt',q)
disparity  = getDisparity(img_r, img_l, "BM")
disp = cv.fromarray(disparity)
Image = cv.CreateMat(disp.rows, disp.cols, cv.CV_32FC3)