Epipolar Geometry - Introduction to Computer Vision - Assignment, Exercises of Computer Vision

During the studies,their is a program called Introduction to computer vision offered in our university, this course is very helpful. The main points disucss in these lecture slides are:Epipolar Geometry, Fundamental Matrix, Eight-Point Algorithm, Hand-Clicked Correspondences, Epipolar Lines, Built-In Matlab Function, Corner Detection, Patch of Neighboring Pixels, Matlab Function

Typology: Exercises

2012/2013

Uploaded on 04/24/2013

baishali
baishali 🇮🇳

4

(2)

84 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE152 Intro to Computer Vision Assignment #3
Instructor: Prof. David Kriegman.
http://cseweb.ucsd.edu/classes/sp12/cse152-a
Due Date: Tue. May 29, 2012.
Instructions:
Attempt all questions
Submit your assignment electronically by email to [email protected] with the subject line
CSE152 Assignment 3. The email should include 1) A 1) a written report that includes all
necessary output images and written answers (e.g., as a Word file or PDF), and 2) all necessary
Matlab code. Attach your code and report as a zip or tar file.
1 Epipolar Geometry:
In class, we learned that the geometry of two camera views are related by a transform called the
“fundamental matrix.“ We can solve for this matrix using an algorithm called the ”eight-point
algorithm“ given at least eight correspondences between the two views. In this assignment, the
eight-point algorithm has already been implemented for you in fund.m. The goal in this section is
to gain some familiarity with how the fundamental matrix relates the two views.
(a) Find the fundamental matrix relating the stereo pair of house1.pgm and house2.pgm with n= 15
hand-clicked correspondences. Plot the epipolar lines l1and l2in both images for at least three
points in the first view, and verify that they pass approximately through the corresponding
points in the second view. Include plots of hand-clicked points and epipolar lines and the values
of the estimated fundamental matrix.
(b) The eight-point algorithm requires only 8 points to solve for the fundamental matrix F, whereas
in part a) you selected 15 points. Using more than 8 points makes the estimated Fmore stable
to errors in hand-clicked locations. A consequence though is that clicked points won’t in general
lie exactly on their epipolar lines. As an estimate of the error in hand-clicked correspondences,
compute the average distance between each clicked point in house2.pgm and its corresponding
epipolar line and include its value in your report.
Notes:
You can use the built-in matlab function cpselect.m to select and save hand-clicked correspon-
dences
Use the provided functions drawLine.m and drawPoint.m to plot points and epipolar lines. An
example of what your plots should look like on a different image pair are shown in Figure 1.
1
pf3
pf4

Partial preview of the text

Download Epipolar Geometry - Introduction to Computer Vision - Assignment and more Exercises Computer Vision in PDF only on Docsity!

CSE152 – Intro to Computer Vision – Assignment # Instructor: Prof. David Kriegman. http://cseweb.ucsd.edu/classes/sp12/cse152-a Due Date: Tue. May 29, 2012.

Instructions:

  • Attempt all questions
  • Submit your assignment electronically by email to [email protected] with the subject line CSE152 Assignment 3. The email should include 1) A 1) a written report that includes all necessary output images and written answers (e.g., as a Word file or PDF), and 2) all necessary Matlab code. Attach your code and report as a zip or tar file.

1 Epipolar Geometry:

In class, we learned that the geometry of two camera views are related by a transform called the “fundamental matrix.“ We can solve for this matrix using an algorithm called the ”eight-point algorithm“ given at least eight correspondences between the two views. In this assignment, the eight-point algorithm has already been implemented for you in fund.m. The goal in this section is to gain some familiarity with how the fundamental matrix relates the two views.

(a) Find the fundamental matrix relating the stereo pair of house1.pgm and house2.pgm with n = 15 hand-clicked correspondences. Plot the epipolar lines l 1 and l 2 in both images for at least three points in the first view, and verify that they pass approximately through the corresponding points in the second view. Include plots of hand-clicked points and epipolar lines and the values of the estimated fundamental matrix.

(b) The eight-point algorithm requires only 8 points to solve for the fundamental matrix F , whereas in part a) you selected 15 points. Using more than 8 points makes the estimated F more stable to errors in hand-clicked locations. A consequence though is that clicked points won’t in general lie exactly on their epipolar lines. As an estimate of the error in hand-clicked correspondences, compute the average distance between each clicked point in house2.pgm and its corresponding epipolar line and include its value in your report.

Notes:

  • You can use the built-in matlab function cpselect.m to select and save hand-clicked correspon- dences
  • Use the provided functions drawLine.m and drawPoint.m to plot points and epipolar lines. An example of what your plots should look like on a different image pair are shown in Figure 1.

Figure 1: 15 hand-clicked points on the stereo pair desk1.gif and desk2.gif were used to compute the fundamental matrix F. Plot shows the locations of these 15 points in both images and their corresponding epipolar lines.

2 Corner Detection:

In this section, we will implement a detector that can find corner features in our images. To detect corners, we rely on the matrix C defined as:

C =

[ ∑

I x^2

∑ IxIy IxIy

I^2 y

]

where the sum occurs over a w × w patch of neighboring pixels around a point p in the image. The point p is a corner if both eigenvalues of C are large.

(a) Implement a procedure that filters an image using a 2D Gaussian kernel and computes the horizontal and vertical gradients Ix and Iy. You cannot use built in routines for smoothing. Your code must create your own Gaussian kernel by sampling a Gaussian function. You can use built-in functions to perform convolution. The width of the kernel should be ± 3 σ. That is, if σ = 2, then the kernel should be 13 pixels wide. Include images of the two components of your gradient Ix and Iy on the image house1.gif for σ = 1, σ = 2, and σ = 4.

(b) Implement a procedure to detect corner points in an image. The corner detection algorithm should compute the smallest eigenvalue λ 2 of the matrix C at each pixel location in the image and use that as a measure of its cornerness score. Run non-maximal suppression, such that a pixel location is only selected as a corner if its eigenvalue λ 2 is greater than that of its 8 neighboring pixels. Have your corner detection procedure return the top n non-maximally suppressed corners. Test your algorithm on house1.gif with n = 50 corners, and plot the resulting detected corners using drawPoint.m. Show corner detection results for σ = 1, σ = 2, and σ = 4.

Notes:

  • An example of what your plots should look like on a different image pair are shown in Figure 2.
  • You can use the Matlab function conv2.m to perform 2D convolution for computing gradient images. Note that I2=conv2(I, k) will result in an output I2 that is bigger than the original input I, while I2=conv2(I, k, ’same’) will result in an output that is the same size.

Figure 3: Predicted corner point matches on desk1.gif and desk2.gif, using just epipolar geometry. In this case, there were 10 correct matches (points 1, 3, 4, 5, 6, 11, 13, 14, 15, 17), 9 incorrect matches (points 2, 7, 8, 10, 12, 16, 18, 19, 20), and one point that was not matched to anything (point 9). Your report should include matching results on the house images when using just epipolar geometry, just NSSD, and when combining epipolar geometry and NSSD.

line is less than τe, and the NSSD distance between the two patches is less than τa. If multiple corner points are within these thresholds, choose the one with the smallest NSSD distance. As before, display images of detected matches, and report the number of correct matches and the number of incorrect matches.

Notes:

  • An example of what your plots should look like on a different image pair are shown in Figure 3.
  • The NSSD distance between two image patches P 1 and P 2 is the sum of squared differences between each pixel in the patch after normalizing each patch by their mean and variance.

N SSD(P 1 , P 2 ) =

i,j

P˜ 1 (i, j) − P˜ 2 (i, j)

P^ ˜ 1 (i, j) = P^1 (i, j)^ −^ μ^1 σ 1

, μ 1 =

n

i,j

P 1 (i, j), σ 1 =

n

i,j

(P 1 (i, j) − μ 1 )^2

  • You can discard corner points that are close to the boundary of the image, such that extracting a patch around that corner point would go outside the boundary of the image.