Ask Your Question
0

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

asked 2018-12-22 14:25:03 -0600

antithing gravatar image

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!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-12-22 16:58:45 -0600

Tetragramm gravatar image

Exactly? Probably not. Unless they used OpenCV internally.

It should be pretty close though, as long as you're using the same camera info and have the same pixel locations.

The biggest variable is probably the matching method. If you aren't matching the pixels correctly, it won't look very similar.

A provided depth map is probably good for the big stuff. If you have a small number of known points, IE: markers, that you need range to, you might be better off doing triangulation because you can make exact matches.

You can also try the various methods and see which is more accurate, and which meets your needs.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-12-22 14:25:03 -0600

Seen: 574 times

Last updated: Dec 22 '18