Problem Set 7 for Computer Graphics Course - Prof. David Jacobs, Assignments of Computer Science

A problem set for a computer graphics course (cmsc 426) focusing on 2d and 3d motion with matrices, structure-from-motion, and corner detection. It includes a variety of problems related to rotation, translation, scaling, and projection of points in two and three dimensions, as well as the implementation of a corner detection algorithm.

Typology: Assignments

Pre 2010

Uploaded on 02/13/2009

koofers-user-t6o
koofers-user-t6o 🇺🇸

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Problem Set 7
CMSC 426
Assigned Tuesday, November 22, Due Thursday, December 8
1. 2D Motion with a Matrix
a. 6 points For each of the following 3x3 matrices, indicate whether it
represents a 2D rotation. Explain your answer.
100
0
3
3
3
6
0
3
6
3
3
100
0
2
3
2
2
0
2
1
2
2
100
0
2
1
4
1
0
4
1
2
1
b. 5 points Give a matrix that will represent a 45 degree clockwise rotation
of 2D points.
c. 5 points Give a matrix that will rotate points clockwise by 90 degrees
about the point (1,2). That is, the effect should be as if you held the point
(1,2) fixed and rotated everything about that point by 90 degrees.
2. 3D Motion with a Matrix
a. 6 points For each of the following 4x4 matrices, indicate whether it
represents a 3D rotation. Explain your answer.
1000
0100
0001
0010
1000
0
2
2
3
2
2
2
0
2
1
3
2
2
1
0
2
1
3
1
2
1
1000
0
3
22
3
1
0
0001
0
3
1
3
22
0
b. 6 points Give matrices that will have the following effects:
i. Translate 3D points in the direction (2,-1,3).
ii. Translate 3D points in the direction (1,0,-1) and then scale them by
a factor of 2.
iii. Scale the points by a factor of 2 and then translate them in the
direction (1,0,-1).
pf3
pf4
pf5

Partial preview of the text

Download Problem Set 7 for Computer Graphics Course - Prof. David Jacobs and more Assignments Computer Science in PDF only on Docsity!

Problem Set 7

CMSC 426

Assigned Tuesday, November 22, Due Thursday, December 8

  1. 2D Motion with a Matrix a. 6 points For each of the following 3x3 matrices, indicate whether it represents a 2D rotation. Explain your answer.

b. 5 points Give a matrix that will represent a 45 degree clockwise rotation of 2D points.

c. 5 points Give a matrix that will rotate points clockwise by 90 degrees about the point (1,2). That is, the effect should be as if you held the point (1,2) fixed and rotated everything about that point by 90 degrees.

  1. 3D Motion with a Matrix a. 6 points For each of the following 4x4 matrices, indicate whether it represents a 3D rotation. Explain your answer.

b. 6 points Give matrices that will have the following effects: i. Translate 3D points in the direction (2,-1,3). ii. Translate 3D points in the direction (1,0,-1) and then scale them by a factor of 2. iii. Scale the points by a factor of 2 and then translate them in the direction (1,0,-1).

c. 5 points Give a rotation matrix that will rotate the y axis so that it points in the same direction as (1,1,1) , while rotating the x axis so that it points in the direction (-1, 0, 1).

d. 5 points Explain why it is not possible to rotate the y axis so that it points in the same direction as (1,1,1) , while rotating the x axis so that it points in the direction (-1, 1, 1).

  1. Structure-from-Motion a. 12 points Suppose we take two images of a scene. In the first image, we find four points with coordinates:

p 11  3 , 6 p^12  5 , 7 p^13  5 , 4 p^14  4 , 8

In the second image, we find the same points, now with coordinates:

p 12  2 , 4 p^22  5 , 7 p 32  2 , 4 p 42  5 , 1

We use the superscript to indicate the image number, and the subscript to indicate the point number. Suppose we know that the 3D coordinates of the four points are: P 1 =(0, 0, 0), P 2 =(1, 0, 0), P 3 =(0, 1, 0), P 4 =(0, 0, 1). Determine what the camera motion was for these two images. You can describe each camera motion using a 2x4 matrix. This matrix will combine together rotation, translation, scaling, and projection to 2D.

b. Challenge problem (5 points): Do the matrices that you found really represent a rigid 3D motion? Explain how you would determine this.

c. 5 points Suppose there is a fifth scene point, which produces the image coordinates:

p^15  9 , 3 p 52  5 , 7

Find the 3D coordinates of this scene point.

  1. 45 points. Corner Detection. You should implement the corner detector that we discussed in class. Recall that to do this we perform the following steps. First, for every point in the image, we form a matrix, C, which is based on the image gradients in the neighborhood of this point. You should compute image gradients in the same way that you did for edge detection, smoothing the image first. I suggest that you reuse the routines image_gradient and smooth_image from the edge detection problem set. Use a 5x5 neighborhood around each point to form C. Then use singular value decomposition, with the matlab routine svd , to find the singular values of C. This is summarized in the equations:

1 2

1 2

UsingSVD 2

2

0

R R

I I I

I II

C

x y y

x x y 

Iy = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 5 5 5 0 0 0 5 5 5 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Using these to build a C matrix for the point (4,4), we get the matrix:

C = 150 25 25 150

Why these numbers? Below, I show all the gradients, as pairs (Ix,Iy). In red are the gradients in a 5x5 neighborhood around the pixel at (4,4). If we square all the Ix values we get 150, since there are six such values. Similarly for squaring Iy. Only pixel (4,4) gives a non-zero value, 25, for Ix*Iy though.

0,0 0,0 0,0 0,0 0,0 0,0 0, 0,0 0,0 0,0 0,0 0,0 0,0 0, 0,0 0,0 0,0 0,5 0,5 0,5 0, 0,0 0,0 5,0 5,5 0,5 0,5 0, 0,0 0,0 5,0 5,0 0,0 0,0 0, 0,0 0,0 5,0 5,0 0,0 0,0 0, 0,0 0,0 5,0 5,0 0,0 0,0 0,

We will have to do this for every point. Performing svd on the matrix C, we get:

svd(C)

ans =

So the cornerness of this point is 125, which is pretty high. Looking at the cornerness of all the points, we get:

Notice that the point with the highest cornerness is located at (5,5), even though intuitively this does not seem to be exactly where the corner is. This is because a 5x5 region centered at (5,5) has the greatest diversity of gradients, since it has all the non-zero gradients we got in the neighborhood around (4,4), plus some new ones.