Ask Your Question

thomas314's profile - activity

2020-01-06 19:26:58 -0600 received badge  Notable Question (source)
2018-04-23 11:18:24 -0600 received badge  Popular Question (source)
2015-05-05 16:26:17 -0600 received badge  Student (source)
2015-01-22 05:22:07 -0600 received badge  Editor (source)
2015-01-22 05:17:28 -0600 commented answer Stereo rectification is not row aligned

I checked the cv::stereoRectify again, with a generic camera calibration matrix [2600, 0, 1280 0, 2600, 960 0, 0, 1] and the distortion parameters found by calibration.

Now it's almost perfectly aligned. So my camera calibration was wrong ...

2015-01-22 03:14:55 -0600 received badge  Self-Learner (source)
2015-01-22 03:14:13 -0600 answered a question Stereo rectification is not row aligned

I implemented a stereo rectification algorithm based on "A compact algorithm for rectification of stereo pairs" by Fusiello et al. It works quite well for my use case.

But I found out what I did wrong: check the camera calibration matrix!

I checked the cv::stereoRectify again, with a generic camera calibration matrix [2600, 0, 1280 0, 2600, 960 0, 0, 1] and the distortion parameters found by calibration. Now I get this result:

image description

2015-01-12 03:39:49 -0600 received badge  Scholar (source)
2015-01-09 05:08:50 -0600 commented question Stereo rectification is not row aligned

thank you! I already thought I made some mistakes. Can you post your comment as an answer, so that I can accept it?

2015-01-08 11:03:24 -0600 asked a question Stereo rectification is not row aligned

I try to rectify two images taken with a Samsung Galaxy S to calculate a depth map. They seem to be correctly rectified, but they are not row aligned, that is the drawn epipolar lines are horizontal, but have different y-values. I rectify the images with stereoRectify(), call initUndistortRectifyMap/remap to rectify the two images.

The rotation/translation is calculated with the fundamental matrix (using manually specified correspondences). It is converted to the essential matrix using intrinsic parameters. Then rotation/translation can be calculated using the formulas specified in Hartley&Zisserman's Multiple View Geometry, "9.6.2 Extraction of cameras from the essential matrix", p. 258

Question: Can you give me a hint to align the rows? In the few tutorials/examples that I found, the images are row-aligned after stereoRectify/initUndistortRectifyMap/remap

I calibrated the camera using a 6x8 checkerboard pattern. The colored lines represent the epipolar lines

rectified images

If you want to rectify the images by yourself:

/* to view the two rectified images side by side,
   insert this source code in samples/cpp/stereo_match.cpp, after the following lines:
img1 = img1r;
img2 = img2r;
*/

cv::Mat imgboth(img1.rows, img1.cols*2, img1.type());
img1.copyTo(cv::Mat(imgboth, cv::Rect(0,0, img1.cols, img1.rows)));
img2.copyTo(cv::Mat(imgboth, cv::Rect(img1.cols, 0, img2.cols, img2.rows)));

cv::namedWindow("rectified", cv::WINDOW_NORMAL);
cv::imshow("rectified", imgboth);
while(cv::waitKey(0) != 'q');

Here the intrinsic and extrinsic parameters.

Here the original images for comparison: screen0.jpg screen1.jpg