Reputation: 330
According to this documentation: http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html
I've obtained m', A, and [R|t]. And then I want to find M'. But I have no idea to find s value, which is a scaling factor. I also can get distance between camera and target using a depth sensor. (I'm using the Intel RealSense 435D)
Please tell me how to find s value using depth information.
Upvotes: 0
Views: 770
Reputation: 1915
The truth is, you dont have to find a value, just find the inverse matrix Q. Let the Opencv handle the rest. since you have D435 means you have stereo and you can perform normal stereo matching and get a list of things.
First Obtained
matrix from
stereoRectify(left_cam_matrix, left_dist_coeffs, right_cam_matrix, right_dist_coeffs,frame_size, stereo_params.R, stereo_params.T, R1, R2, P1, P2, Q, CALIB_ZERO_DISPARITY, 0, frame_size, 0, 0);
Then obtain depth and color image from stereo matching output.
sgbm->compute(img1, img2, disp);
At least call
C++: void reprojectImageTo3D(InputArray disparity, OutputArray _3dImage, InputArray Q, bool handleMissingValues=false, int ddepth=-1 )
The 3D pointcloud is in the variable called _3Dimage
If you search for the 3 functions, you will realize that you can find it in the OpenCV directly https://github.com/opencv/opencv/blob/master/samples/cpp/stereo_match.cpp
Upvotes: 1