Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Is there any difference between calculating 3d points from a depth map, vs triangulating?

As above. I have a depth map from a pre-calibrated stereo camera.

I am getting 3d points using:

            int y = kpts[kp].pt.y;
            int x = kpts[kp].pt.x;
            cv::Vec3d tmpPoint;
            sl::float1 dist;
            depth_image_zed.getValue(x, y, &dist);

            if (isValidMeasure(dist) && dist != 0) {

                tmpPoint(0) = x;
                tmpPoint(1) = y;
                tmpPoint(2) = dist * 10;

                //get actual coordinates
                float cx = zed.getCameraInformation().calibration_parameters.left_cam.cx;
                float cy = zed.getCameraInformation().calibration_parameters.left_cam.cy;
                float fx = zed.getCameraInformation().calibration_parameters.left_cam.fx;
                float fy = zed.getCameraInformation().calibration_parameters.left_cam.fy;

                cv::Vec3d tmpVec;
                double x3D = ((tmpPoint(0) - cx) * tmpPoint(2)) / fx;
                double y3D = ((tmpPoint(1) - cy) * tmpPoint(2)) / fy;
                pcl::PointXYZ pnt;
                pnt.x = x3D;
                pnt.y = y3D;
                pnt.z = tmpPoint(2);

My question is, if I was to match these same points, and triangulate them using opencv, with the same calibration, would i get the exact same points? Is there any difference is using a stereo depth map, vs stereo triangulation, for 3d point positions?

thanks!