OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Mon, 11 Feb 2019 23:29:07 -0600Triangulate Chessboard gives weird resultshttp://answers.opencv.org/question/208725/triangulate-chessboard-gives-weird-results/Hi all,
So I'm trying to create a projection in 3D with use of stereo camera with use of Python.
I found the intrinsic camera calibration parameters, which seem good.
Then I find the chessboard corners on both images with :
`_, C1 = cv2.findChessboardCorners(img1, (6, 9), None)`.
I undistort the found corners with:
`C1Norm = cv2.undistortPoints(C1, K1, D1)`
And use those to find the essential matrix with:
`E, mask = cv2.findEssentialMat(C1Norm, C2Norm, focal=1.00, pp=(0., 0.), method=cv2.RANSAC, prob=0.999)`.
And at last I find the rotation and translation between the cameras with:
`M, R, t, mask = cv2.recoverPose(E, C1Norm, C2Norm)`.
Now with use of that I find the projection matrix of both cameras;
`P1 = K1 * [I3 | 0]` and `P2 = K2 * [R | t]` where K1 and K2 are the intrinsic camera parameters and I is an 3x3 identity matrix.
Last step now should be to triangulate. I use `4D = triangulatePoints(P1, P2, C1Trans, C2Trans)` which gives me the 4D coordinates.
However, when I plot this, my chessboard is all crooked and wrong. Has anyone any idea where something might go wrong?
Also, I know the dimensions of the chessboard, any idea how I can turn the homogeneous coordinates of the chessboard corners to cm?
BerrentMon, 11 Feb 2019 23:29:07 -0600http://answers.opencv.org/question/208725/Triangulate Points from Stereo Imagehttp://answers.opencv.org/question/102712/triangulate-points-from-stereo-image/ Hello guys,
I hope someone can help me with my problem :)
**That's my approach**
I have two cameras and now I want to calculate the 3D coordinates of an object. For this, I calibrate the cameras individually and then I use stereoCalibrate.
Now I have the intrinsic and extrinsic parameters and would like to triangulate.
To do that, I create the projection Matrices like this.
Basically one camera I can keep as P1= K1 [I|0] (identity rotation and 0 translation), and the other camera P2= K2*[R|t] (rotation and translation between the cameras from stereoCalibrate())
These matrices I hand over to the triangulate function (http://www.morethantechnical.com/2012/01/04/simple-triangulation-with-opencv-from-harley-zisserman-w-code/)
**To test the triangulation**
Checkerboard: 9x6 and 12 mm per square
I use the reference checkerboard images because the depth should be constant but i have depth "linear".
The x and y coordinates are accurate over the entire distance to 0.2mm.
The picture shows the values for the first two rows. As you can see the depth is strange
![image description](/upfiles/14744601134612977.png)
Anyone know where is my problem?
Thanks.TiBeWed, 21 Sep 2016 07:15:31 -0500http://answers.opencv.org/question/102712/