Docsity

Problem Set 6 Review for Exam - Image Processing | CMSC 426, Assignments of Computer Science

Toggle sidebar
bg1
Problem Set 6
CMSC 426
Assigned Thursday, April 1; Due Thursday, April 15
1. 60 points. Stereo Matching: For this problem set you will implement a stereo
matching algorithm. It will compute the disparity for a pixel in the left image by
matching it to nearby pixels in the right image. Matching is based on comparing
the Sum of Square Differences (SSD) between a region around the pixel in the left
image and a region around each of the possible matching pixels in the right
image. You may assume that the images are rectified so that the epipolar lines are
the horizontal scan lines. You may also assume that the disparity will always
range between 0 and 16. This means, for example, that the pixel (17,23) in the
left image will match, in the right image, one of the pixels (17,23), (17, 22), …
(17,8). Your function should look something like: D = stereo_ssd(left, right, n),
where D is a disparity map, left and right are the two images, and an nxn window
is used for comparison. That is, D is the same size as left and right, and gives the
disparity for every pixel in left. Note that this is the algorithm described in
Trucco and Verri p. 146, called CORR_MATCHING. Test your algorithm on the
image pairs I1L, I1R, and the pair T3bw, T4bw, available on the class web page.
Print images of the resulting disparity maps.
2. Image Rectification.
a. 10 points. Pencil and paper warm-up. Suppose we have a camera with a
focal point at (0,0,0) and an image plane described by z = 100 + x. We
want to rectify this image, so that it appears as it would if taken with a
camera with a focal point at (0,0,0) and an image plane at z = 100 (see
picture below).
i. Suppose the camera takes a picture with pixels extending from
(-30, 0 60) to (0,0,100). Where would these pixels appear in the
rectified image? (Part b, below, contains a hint about the answer).
pf3
pf4

Partial preview of the text

Download Problem Set 6 Review for Exam - Image Processing | CMSC 426 and more Assignments Computer Science in PDF only on Docsity!

Problem Set 6

CMSC 426

Assigned Thursday, April 1; Due Thursday, April 15

  1. 60 points. Stereo Matching: For this problem set you will implement a stereo matching algorithm. It will compute the disparity for a pixel in the left image by matching it to nearby pixels in the right image. Matching is based on comparing the Sum of Square Differences (SSD) between a region around the pixel in the left image and a region around each of the possible matching pixels in the right image. You may assume that the images are rectified so that the epipolar lines are the horizontal scan lines. You may also assume that the disparity will always range between 0 and 16. This means, for example, that the pixel (17,23) in the left image will match, in the right image, one of the pixels (17,23), (17, 22), … (17,8). Your function should look something like: D = stereo_ssd(left, right, n), where D is a disparity map, left and right are the two images, and an nxn window is used for comparison. That is, D is the same size as left and right, and gives the disparity for every pixel in left. Note that this is the algorithm described in Trucco and Verri p. 146, called CORR_MATCHING. Test your algorithm on the image pairs I1L, I1R, and the pair T3bw, T4bw, available on the class web page. Print images of the resulting disparity maps.
  2. Image Rectification. a. 10 points. Pencil and paper warm-up. Suppose we have a camera with a focal point at (0,0,0) and an image plane described by z = 100 + x. We want to rectify this image, so that it appears as it would if taken with a camera with a focal point at (0,0,0) and an image plane at z = 100 (see picture below). i. Suppose the camera takes a picture with pixels extending from (-30, 0 60) to (0,0,100). Where would these pixels appear in the rectified image? (Part b, below, contains a hint about the answer).

ii. If we want to find the intensity in the rectified image at the position (-25,0,100), where would we need to look in the original image? b. 20 points Now you’re going to write a program to perform rectification for a 1D image in the y=0 plane. This will have the form: [O,s] = rectify1D(I,xs,zs,xe,ze). We will assume that the focal point is always at (0,0,0). We will also assume that all coordinates are written in units of pixels. The pixels in the original image are contained in the vector I. In world coordinates, this image appears on the image plane beginning at the point (xs, 0, zs), and extends to the point (xe, 0, ze). This means that we must have length(I) >= sqrt((xs-xe)^2 + (zs-ze)^2), so that the region in the image plane that contains the image is no longer than the number of pixels we have in the image. If I contains extra pixels, they don’t need to be used in the rectified image. Our goal is to rectify the image so that it appears as if it were taken by a camera with a focal point at (0,0,0), and an image plane at z=100. So to rectify an image according to the geometry shown in the picture above, we would need I to be a vector 50 long containing 50 intensities, and we would call: [O,s] = rectify1D(I, -30, 60, 0, 100). rectify1D will produce two outputs. O is a vector of pixel intensities for the rectified image. s indicates the x coordinate in the image plane where the rectified image starts.

Camera’s pixels (-30,0,60) Rectified image plane Original image plane

z=

z=100+x Focal point

c. 10 Points. Now extend this code to rectify a 2D image. We will assume that the original 2D image differs from the rectified image only by a rotation about the y axis, to keep things relatively simple. This means that we have the same geometry shown above, except we could draw the same picture for any plane with a constant y value. Your program, rectify2D should take as input an unrectified 2D image, along with the (x,y,z) coordinates in the world of the lower left-hand corner of the image, and of the upper right hand corner. To be more explicit, if the lower left corner of the image is (xs,ys,zs), and the upper right corner is (xe,ye,ze), then you may assume that the other two corners of the rectangular image are (xs,ye,zs), and (xe,ys,ze). You may assume, again, that the focal point is at (0,0,0), and that the rectified image should be in the z = 100 plane. Run this code on the image I3.jpg, with the lower left-hand corner designated at (0,0,100), and the upper right-hand corner at (100,100,50). Print and turn in the result.