OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Tue, 13 Sep 2016 01:39:19 -0500StereoCalibration RMS Problemhttp://answers.opencv.org/question/102231/stereocalibration-rms-problem/Hi guys,
I have a strange Problem.
I want to calibrate a vertical stereo camera system.
First I calibrate each camera individually
double rms = calibrateCamera(xObjektPoints, xImageCam1, Size(3000,4000), intrinsic, distCoeffs[0], rvecs1, tvecs1, CV_CALIB_USE_INTRINSIC_GUESS + CV_CALIB_ZERO_TANGENT_DIST);
double rms2 = calibrateCamera(xObjektPoints, xImageCam2, Size(3000, 4000), intrinsic2, distCoeffs[1], rvecs2, tvecs2, CV_CALIB_USE_INTRINSIC_GUESS + CV_CALIB_ZERO_TANGENT_DIST);
The RMS are 0,21 and 0,23...thats okay...but now I use stereoCalibrate and the RMS is **24**
double rms3 = stereoCalibrate(xObjektPoints, xImageCam1, xImageCam2,
intrinsic, distCoeffs[0],
intrinsic2, distCoeffs[1],
Size(3000, 4000), R, T, E, F,
TermCriteria(CV_TERMCRIT_ITER + CV_TERMCRIT_EPS, 100, 1e-5)
);
Can someone help me?
ThanksTiBeTue, 13 Sep 2016 01:39:19 -0500http://answers.opencv.org/question/102231/Stereocalibration coordinate origin questionhttp://answers.opencv.org/question/22582/stereocalibration-coordinate-origin-question/Hi,
I have a question about the origin of the stereocalibration. I have a pair of cameras calibrated using cv::stereocalibrate. I wish to recover 3D physical coordinates of specific points in the image using cv::triangulatepoints.
The question is where is the origin and the axis orientation of the recovered (X,Y,Z) physical coordiantes? I didn't find information in opencv documentation.
In "Learning OpenCV: Computer Vision with the Opencv" by Gary Bradski, Adrian Kaehler, the authors defined the origin to be center of projection of the left camera, with X positive towards right camera, Y downwards and Z away from camera. Is this right?pziyangWed, 16 Oct 2013 15:20:21 -0500http://answers.opencv.org/question/22582/triangulate to 3-D on corresponding 2-D pointshttp://answers.opencv.org/question/8369/triangulate-to-3-d-on-corresponding-2-d-points/I have a left and right image of a scene, taken with identical cameras. The cameras were placed fairly far apart, about 135cm, and the difference in the angle of their gaze is maybe 30 degrees. I've calibrated the two cameras independently with asymmetric circles, and the resulting values seem sane and can undistort images in a sane way.
There is an object in the images with known dimensions -- it's a table. By hand, I've identified the x,y pixel coordinates of 8 corresponding key points in each image (6 on the table top plane, 2 below in the table's legs). I know the true 3-D coordinates of those 8 points in the scene because I measured them.
How can I use the 2 camera matrices, 2 distortion vectors, 2 vectors of 8 corresponding 2-D points, 1 vector of 8 corresponding 3-D points to arrive at a formula/algorithm to approximate new 3-D points given their 2-D location in each image? I've been testing by trying to recreate the 3-D location of those 8 points, but I plan to use it on new features in phase 2 of this project.
Here's what I've tried so far.
Attempt #1:
- stereoCalibrate to get rotation and translation between cameras
- stereoRectify to get left and right projection matrices
- triangulatePoints using the two projection matrices and the two sets of undistorted points, and convert from homogeneous to "normal" using convertPointsFromHomogeneous
Attempt #2:
- solvePnP, independently for left and right, on the 2-D and 3-D points to arrive at rotation and translation
- get the relative rotation and translation between the cameras by subtraction one rotation vector from the other and one translation vector from the other (yes, this could easily be wrong)
- stereoRectify to get left and right projection matrices
- triangulatePoints using the two projection matrices and the two sets of undistorted points, and convert from homogeneous to "normal" using convertPointsFromHomogeneous
Attempt #3:
- solvePnP, independently for left and right, on the 2-D and 3-D points to arrive at rotation and translation
- undistortPoints on the 2-D points
- make a 3x4 projection matrix for left and right as [R | T] (yes, this could easily be wrong but I must have read it somewhere)
- triangulatePoints using the two projection matrices and the two sets of undistorted points, and convert from homogeneous to "normal" using convertPointsFromHomogeneous
If I had to guess, I'd say Attempt #1 is the best as it uses the higher level stereoCalibrate and it just so happens that the length of the translation vector is 132cm -- maybe a coincidence, but that is the distance between the cameras.
However, all these attempts (and many minor variations) give 3D answers that seem to be nonsense. For instance, one of the points is given as 50 meters away from the scene. They don't resemble the 3D points used as inputs.
This is my first OpenCV project, so I'm sure I'm doing something foolish. I have done a lot of reading online trying to find an example that works, but nothing yet. I'd really appreciate any guidance.
RaveTheTadpoleSat, 02 Mar 2013 23:02:33 -0600http://answers.opencv.org/question/8369/