Task: Epipolar Geometry

Write a script/function, that visualizes correspondences and epipolar geometry between pair of images. Images, correspondences, and fundamentral matrix F is here.

The set of correspondences is produce by an automatic wide-baseline stereo matching tool, it contains both correct correspondences and mismatches. These must be separated, according to consistency with epipolar constraint:

  1. for each corresponding pair $i$ of points, compute symmetric epipolar distance $d_i = 0.5\sqrt{d_{1,i}^2 + d_{2,i}^2}$ where $d_{1,i}$ is euclidean (!) distance of a point $u_{1,i}$ to the corresponding epipolar line $l_{1,i} = F^T u_{2,i}$ in the first image, and $d_{2,i}$ is euclidean distance of a point $u_{2,i}$ to the corresponding epipolar line $l_{2,i} = F u_{1,i}$ in the second image.
  2. choose appropriate threshold, e.g. $\theta=1$ px and separate correspondences to inliers ($d_i \le \theta$) and outliers ($d_i \gt \theta$).
  3. Show the inliers (red) and outliers (black) as a needle map over one image. (A 'needle' is line joining coordinates of corresponing point in both image, but drawn to a single image.) Consistent motion should be visible in the inliers.
  4. Select 20 (eg. random) correspondences from inliers, and draw to both images the points and the corresponding epipolar lines, in different but corresponding colours.
In [5]:
%run task_eg