I'm trying to triangulate some points from a stereo camera system.
First, I used the sample "stereo_calib" (cpp) to get the extrinsic parameters in a yml file :
- R
- T
- R1
- R2
- P1
- P2
- Q
Is there a way to check if the values are correct ?
Then I use the method:
cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, CvMat* projPoints1, CvMat* projPoints2, CvMat* points4D)
I used P1 for projMatr1 and P2 for projMatr2.
The point I want to triangulate is at coordinate x=919,y=686 on left image and x=586,y=694 on the right one. I tried this but I'm not sure if it's the good way:
int co1[] = {919,686};
Mat point1(2, 1, CV_32FC1, co1);
int co2[] = {586,694};
Mat point2(2, 1, CV_32FC1, co2);
Mat points4D;
I used point1 for projPoints1 and point2 for projPoints2. I wrote points4D in a yml file at the end. This is the result I got:
%YAML:1.0
Points4D: !!opencv-matrix
rows: 4
cols: 1
dt: f
data: [ 2.34857202e-001, 1.03716120e-001, -9.66480732e-001,
1.43435571e-007 ]
What does it mean ? The three first values are x, y and z of the reconstruct point ? The values seems strange to me, but I'm really knew with openCV do I don't know much about it.
I found this related question: How to correctly use cv::triangulatePoints(). But it didn't really help me...
Thanks for the help !
EDIT
the calibration gives me this:
P1: !!opencv-matrix
rows: 3
cols: 4
dt: d
data: [ 1.5334888857352591e+003, 0., 1.1192188110351562e+003, 0., 0.,
1.5334888857352591e+003, 9.1114062500000000e+002, 0., 0., 0., 1.,
0. ]
P2: !!opencv-matrix
rows: 3
cols: 4
dt: d
data: [ 1.5334888857352591e+003, 0., 1.1192188110351562e+003,
4.3953258083993223e+003, 0., 1.5334888857352591e+003,
9.1114062500000000e+002, 0., 0., 0., 1., 0. ]
I used the chessboard in the doc print on a A4 format paper.