ECE 470: Homework 5 - Seth A. Hutchinson
Transcript of ECE 470: Homework 5 - Seth A. Hutchinson
ECE 470: Homework 5
Due Tuesday, October 27
in class @12:30pm
Seth Hutchinson
Luke A. Wendt
ECE 470 : Homework 5
1
Consider a camera with focal length λ = 1. Suppose the optical axis of the camera is aligned with the
world x-axis, the camera x-axis is parallel to the world y-axis, and the center of projection has coordinates
[0, 0, 2]w. For the the points listed below, compute the camera frame coordinates. Indicate if any of these
points will not be visible to a physical camera, and then compute the image plane coordinates for every
visible point.
xw yw zw xc yc zc visible? u v
1. 2 2 2
2. 1 0 3
3. 0 2 −3
4. −2 3 3
2
A stereo camera system consists of two cameras that share a common field of view. By using two cameras,
stereo vision methods can be used to compute 3D properties of the scene. Consider stereo cameras with
coordinate frames o1 and o2 such that
H12 =
1 0 0 b
0 1 0 0
0 0 1 0
0 0 0 1
.Here, b is called the baseline distance between the two cameras. Suppose that a 3D point p projects onto
these two images with image plane coordinates [u1, v1] in the first camera and [u2, v2] in the second camera.
Determine the depth, z = z1 = z2, of the point p = [x, y, z]T .
3
Show the projection of a line in R3 is a line in the image plane. A geometric explanation will be sufficient.
4
Consider two lines in R3, given parametrically by x
y
z
= pi + αini, i ∈ {1, 2},
in which pi = [ xi yi zi ]T is a point in R3 on line i, and αi ∈ R is the distance traveled from this point
along the direction ni given as a unit normal vector in R3 with nTi ni = 1. If the lines are parallel, then
n = n1 = n2 = [ nx ny nz ]T . Show the projections of these two lines in an image plane intersect at a
single point. This point is called the vanishing point.
5
Show that the vanishing points for all 3D horizontal lines must lie on the line v = 0 of the image plane.
Page 1 of 4
ECE 470 : Homework 5 5
6
Suppose the vanishing point for two parallel lines has the image coordinates [u∞, v∞]. Show that the direction
vector for the 3D line is given by
n =1√
u2∞ + v2∞ + λ2
u∞v∞λ
in which λ is the focal length of the imaging system.
7
Two parallel lines define a plane. Consider a set of pairs of parallel lines such that the corresponding planes
are all parallel. Show that the vanishing points for the images of these lines are colinear. Hint: let n0 be
the normal vector for the parallel planes Πi and exploit the fact that nTi n0 = 0 for the direction vector niassociated to the ith line.
8
Optimal Thresholding:
An image consists of an object and a background. The probability that a randomly selected pixel belongs
to the background is given by P0, with 0 < P0 < 1. Similarly, the probability that a randomly selected pixel
belongs to the object is given by P1, with 0 < P1 < 1. The probability that a background pixel (resp. object
pixel) will have intensity value z is given by f0 (resp. f1):
f0(z) =1√
2πσ0e− (z−µ0)2
2σ20 , f1(z) =1√
2πσ1e− (z−µ1)2
2σ21 . (1)
Assume that µ0 < µ1 (i.e., the background is darker than the object).
Suppose now that a single threshold t is to be selected, such that any pixel with intensity z will be la-
beled as background if z ≤ t, and as object if z > t. There are two possible kinds of error that can be made
when applying the rule: (i) a background pixel has intensity z > t, or (ii) an object pixel has intensity z ≤ t.The former case is called a false positive, and the latter is called a false negative.
For a given threshold t, denote the probability of a false positive by E0(t), and the probability of a false
negative by E1(t). These probabilities are given by
E0(t) =
∫ ∞t
P0f0(z)dz E1(t) =
∫ t
−∞P1f1(z)dz (2)
The total probability of error is, Perr(t) = E0(t) + E1(t).
8 (a)
Assuming σ0 6= σ1, find an expression for t that minimizes Perr(t). The expression will be a quadratic
function of t, parameterized by P0, P1, σ0, σ1, µ0, and µ1. This expression should not contain any integrals.
8 (b)
Suppose that σ0 = σ1. Find a closed form expression for the optimal value of t.
Page 2 of 4
ECE 470 : Homework 5 8
9
Extra Credit: Inverse Homography
Consider two image planes (prime and unprime) and point i with projected coordinates [u′i, v′i]T and [ui, vi]
T
in the image planes. Expressing these as homogeneous coordinates, they have the linear relationship
γ
u′iv′i1
≈ h11 h12 h13h21 h22 h23h31 h32 h33
uivi1
,where γ = h31ui + h32vi + h33. This can be rewritten in nonlinear form as
[(h31ui + h32vi + h33)u′i(h31ui + h32vi + h33) v′i
]≈[h11 h12 h13h21 h22 h23
] uivi1
.For N points, these equations can be expressed linearly with respect to the unknown values of H with
A~H =
ui vi 1 0 0 0 −u′iui −u′ivi −u′i0 0 0 ui vi 1 −v′iui −v′ivi −v′i...
......
......
......
......
uN vN 1 0 0 0 −u′NuN −u′NvN −u′N0 0 0 uN vN 1 −v′NuN −v′NvN −v′N
︸ ︷︷ ︸
A
h11h12h13h21h22h23h31h32h33
≈
0
0...
0
0
.
This equation can be solved by finding ~H that minimizes, (A~H)T (A~H) = ~HT (ATA) ~H, which should ideally
be zero. The matrix ATA is symmetric and can be decomposed into V DV T , where D is a diagonal of
eigenvalues and V is an orthogonal matrix. In Matlab, this can be computed with, [V,D] = eig(A′*A). The
eigenvector with the smallest eigenvalue will be the optimal choice for ~H. This can be computed in Matlab
with, [value,index]=min(diag(D));vecH=V(:,index).
H⇒
9 continued on next page. . . Page 3 of 4
ECE 470 : Homework 5 9 (continued)
If the first four corners are given by
Point 1: [u1, v1] = [ 1.9, 10.9] [u′1, v′1] = [0, 0]
Point 2: [u2, v2] = [ 1.1, 38.7] [u′2, v′2] = [0, 1]
Point 3: [u3, v3] = [19.2, 1.0] [u′3, v′3] = [1, 0]
Point 4: [u4, v4] = [18.6, 49.7] [u′4, v′4] = [1, 1]
and the 5th point gives the center of the ball at [u5, v5]T = [9.6, 13.8]T , what is [u′5, v′5]T ?
Page 4 of 4