Saturday, February 6, 2016

Epipolar Rectification 9b (ER9b)

ER9b is an implementation of Quasi-Euclidean Uncalibrated Epipolar Rectification by A. Fusiello and L. Irsara. ER9b also contains an implementation of Distinctive Image Features from Scale-Invariant Keypoints by David G. Lowe and an implementation of Automatic Homographic Registration of a Pair of Images, with A Contrario Elimination of Outliers by Lionel Moisan, Pierre Moulon, and Pascal Monasse. Unlike Epipolar Rectification 9, this is my own implementation (of the whole enchilada including SIFT and ORSA).

Note that the A Contrario elimination of outliers is referred as ORSA (Optimized Random SAmple) or AC-RANSAC (A Contrario RANSAC). RANSAC (RANdom SAmple Consensus) is the reference algorithm when you need to get rid of outliers in a set of matches between two images. The advantage of A Contrario RANSAC over plain RANSAC is that it eliminates the always delicate thresholding that's needed to separate the inliers from the outliers.

Epipolar rectification (of the uncalibrated kind) takes 2 images and transform them such that stereo matches are all along horizontal lines. This is crucial to get the best possible results in automatic depth map generation. The input 2 images can really be anything as long they represent the same scene.

Here's an example:

First image.

Second image.

These two images were taken with a regular non-stereo camera without paying too much attention of horizontal alignment.

Wiggle created from the 2 images.

Clearly, those need to be rectified prior to generating a depth map.

This is the first image rectified by ER9b.

This is the second image rectified by ER9b.

Wiggle created from the 2 rectified images.

Even though pieces of the image get lost due to camera rotation, the movement is now on the horizontal.

ER9b also outputs (in an image format) the features detected by SIFT, the matches found by SIFT, and the (good) matches found by ORSA.

Features (keypoints) detected by SIFT in first image.

Features (keypoints) detected by SIFT in second image.

Matches found by SIFT in the 2 images. A match is represented by two rectangles of the same color. These matches must be processed by a RANSAC type of algorithm in order to reject the outliers.

Matches remaining after ORSA has removed the outliers.

It should be noted that ER9b gives the minimum and maximum disparity of the rectified stereo pair in the console window printout. These disparities can be used as input to the automatic depth map generators that are available here for download. Unlike ER9, there's no need to manipulate those values.

Here is a video tutorial for ER9b:

The windows executable (guaranteed to be virus free) is available for free via the 3D Software Page.

Source code: ER9b on github.

1 comment:

  1. Hello Ugo,
    I'm still searching a way to align the images from my stereo cam (two synchron Canon S110).
    StereoPhotoMaker is not bad but I often have to realign the pictures manually.
    I tried your programs but the images are cropped at the right edge and the left edge shrinks together really small, so that aspect ratio is not maintained.
    So my question is:
    Is there a way to leave one image untouched(let's say the right image) and only scale the other image so it fits to the other?