CS 231A Computer Vision Midterm
Out: 12:30pm, February 25, 2015
Due: 12:30pm, February 27, 2015
1
Transformations
Solution Set
In this question, we will explore some interesting lowlevel properties of transformations.
(a) In the lectures, we showed that a 3D rotation can be formed as the product of three matrices
where
R _{x} (α) =
1
0
0
0
cos α
sin α
R = R _{x} (α)R _{y} (β)R _{z} (γ),
0
− sin α cos α
, R _{y} (β) =
cos β
0
− sin β
0
1
0
sin β
0
cos β
, R _{z} (γ) =
cos γ
sin γ
0
− sin γ cos γ
0
0
0
1
are rotations around the x, y, and z axis, respectively. This is called the XYZ Euler angle representation, indicating the order of matrix multiplication.
However, representing rotations in this form can lead to ambiguities, since the result de pends on the order in which the transforms are performed.
Let p ^{} be the point obtained by rotating a point p with a rotation matrix R, so p ^{} = Rp. Give an expression for p ^{} obtained by rotating p in the following two ways:
• First rotate α around x axis, then rotate γ around z axis.
• First rotate γ around z axis, then rotate α around x axis.
Show that these rotations produce diﬀerent values of p ^{} .
Solution:
No, the result is dependent on the order of rotation.
1
p ^{} = R _{x} (α)R _{z} (γ)p
1
0
0
0
cos α
sin α
cos γ
0
− sin α cos α
cos γ 
− sin γ 
0 

sin γ 
cos γ 
0 

0 
0 
1 

0 

− sin α cos α 
p 

1 
0 
0 

0 
cos α 
− sin α 

0 
sin α 
cos α 
sin γ sin α − cos γ sin α cos α
p
=
− sin γ
cos α cos γ sin α cos γ
=
cos α sin γ sin α sin γ
p ^{} = R _{z} (γ)R _{x} (α)p
=
=
cos γ
sin γ
0
cos γ
sin γ
0
− sin γ cos γ
0
− sin γ cos α cos γ cos α sin α
0
0
1
2
p
p
(b)
(c)
To avoid the representation ambiguity introduced in part a, we can ﬁx the rotation order. However, even if the order of rotation is ﬁxed, this rotation system may still result in a degenerate representation.
For instance, let α, β , and γ be three diﬀerent angles. We can represent an arbitrary rotation with respect to the XYX axes as the product R _{x} (α)R _{y} (β)R _{x} (γ) (note that the axes here are XYX, not XYZ). This representation of a rotation matrix should have three degrees of freedom. However if we set β = 0, something unusual happens. How many degrees of freedom are left? Hint: some trigonometric identities may be useful.
Solution:
R _{x} (α)R _{y} (0)R _{x} (γ) =
=
=
1
0
0
1
0
0
1
0
0
0
cos α
sin α
0
− sin α
cos α
1 0
0 1
0
0
0
cos α cos γ − sin α sin γ sin α cos γ + cos α sin γ
0
cos(α + γ) sin(α + γ)
0
− sin(α + γ) cos(α + γ)
0
0
1
1
0 cos γ
0
sin γ
0
0
− sin γ
cos γ
0
− cos α sin γ − sin α cos γ − sin α sin γ + cos α cos γ
Since it is parameterized by (α + γ), it only has one degree of freedom.
To avoid the loss of a degree of freedom mentioned above, we can use an alternative rotation representation deﬁned as follows:
R(nˆ, θ) = I + sin θ[nˆ] _{×} + (1 − cos θ)[nˆ] ^{2}
×
,
where nˆ is a unit vector and θ is the angle of rotation. Recall that [·] _{×} is the matrix cross product operator (see Lecture 5).
Any valid rotation representation must satisfy some properties of rotation. Generally, for any rotation matrix R, we must have that R ^{T} R = I. Prove that this equality holds for the rotation matrix R deﬁned above. (Hint: Consider the rotation given by R ^{T} .)
Solution:
[nˆ] ^{T} = −[nˆ] _{×} because
×
[nˆ] ^{T}
×
=
Therefore, we have
0
n _{z}
−n _{y}
−n _{z}
0
n _{x}
n _{y}
−n _{x}
0
T = −n _{z}
0
n _{y}
n _{z}
0
−n _{x}
−n _{y}
n _{x}
0
R(nˆ, θ) ^{T} = (I + sin θ[nˆ] _{×} + (1 − cos θ)[nˆ] ^{2}
^{)}
× ^{)}
×
= I + sin θ[nˆ] ^{T} + (1 − cos θ)([nˆ] ^{2}
×
= I − sin θ[nˆ] _{×} + (1 − cos θ)[nˆ] ^{2}
= R(nˆ, −θ)
×
3
= −[nˆ].
^{T}
^{T}
Therefore, applying R ^{T} R is equivalent to not rotating at all, so R ^{T} R = I.
Alternatively, students can also write out R ^{T} R explicitly. First, [nˆ] ^{T} = −[nˆ] _{×} because
×
[nˆ] ^{T}
×
=
0
n _{z}
−n _{y}
−n _{z}
0
n _{x}
n _{y}
−n _{x}
0
T = −n _{z}
0
n _{y}
n _{z}
0
−n _{x}
−n _{y}
n _{x}
0
= −[nˆ].
Also observe that [nˆ] _{×} ^{2} = nˆˆn ^{T} − I , so we have
[nˆ] _{×} ^{4} = (nˆˆn ^{T} − I)(nˆˆn ^{T} − I)
Thus,
= nˆˆn ^{T} nˆˆn ^{T} − 2nˆˆn ^{T} + I
= nˆˆn ^{T} − 2nˆˆn ^{T} + I
= −[nˆ] ^{2} × .
R ^{T} R = (I + sin θ[nˆ] _{×} + (1 − cos θ)[nˆ] _{×} ^{2} ) ^{T} (I + sin θ[nˆ] _{×} + (1 − cos θ)[nˆ] ^{2} × )
= (I − sin θ[nˆ] _{×} + (1 − cos θ)[nˆ] _{×} ^{2} )(I + sin θ[nˆ] _{×} + (1 − cos θ)[nˆ] ^{2} × )
= I + sin θ[nˆ] _{×} + (1 − cos θ)[nˆ] ^{2} _{×} − sin θ[nˆ] _{×} − sin ^{2} θ[nˆ] _{×} ^{2} − sin θ(1 − cos θ)[nˆ] ^{3}
×
+ (1 − cos θ)[nˆ] ^{2} _{×} + sin θ(1 − cos θ)[nˆ] _{×} ^{3} + (1 − cos θ) ^{2} [nˆ] ^{4}
×
= I
(d) Let us now consider points in 1D. In homogeneous coordinates, a point in 1D can be represented as (x, 1) ^{T} , where x ∈ R. More generally, such a point can be represented as (kx, k) ^{T} or generally as (x _{1} , x _{2} ) ^{T} .
A projective transformation of a point in 1D is represented by a 2 × 2 matrix,
x ^{} = H _{2}_{×}_{2} x,
where H _{2}_{×}_{2} has a nonzero determinant.
Given 4 points on a line, the cross ratio is deﬁned as
where
Cross(x _{1} , x _{2} , x _{3} , x _{4} ) = ^{}^{x} ^{1} ^{x} ^{2} ^{}^{}^{x} ^{3} ^{x} ^{4} ^{}
x _{1} x _{3} x _{2} x _{4}  ^{,}
x _{i} x _{j}  = det
^{x}
x
^{i}^{1}
i2
^{x}
x
^{j}^{1}
j2
with point x _{i} given by (x _{i}_{1} , x _{i}_{2} ) ^{T} and x _{j} given by (x _{j}_{1} , x _{j}_{2} ) ^{T} .
Prove that the value of the cross ratio is invariant under any projective transformation of the line: ie show that if x ^{} = H _{2}_{×}_{2} x, then
Cross(x ^{} _{1} , x _{2} ^{} , x ^{} _{3} , x _{4} ^{} ) = Cross(x _{1} , x _{2} , x _{3} , x _{4} ).
Equivalently, the cross ratio is invariant to the projective coordinate frame chosen for the line.
4
Solution:
x i ^{} x
_{j}  = λ _{i} Hx _{i} λ _{j} Hx _{j} 
= det
λ i H 11 x i1 λ i H 21 x i1
+
+
λ i H 12 x i2 λ i H 22 x i2
λ j H 11 x j1 λ j H 21 x j1
+
+
=
λ _{i} λ _{j} (x _{i}_{1} x _{j}_{2} − x _{i}_{2} x _{j}_{1} ) det ^{H}
11
H 21
H
H 22
12
= λ _{i} λ _{j} x _{i} x _{j}  det H
λ j H 12 x j2 λ j H 22 x j2
Cross(x ^{} _{1} , x _{2} ^{} , x ^{} _{3} , x _{4} ^{} ) = ^{}^{x} ^{}
x ^{}
1 ^{x} ^{}
_{2} x ^{}
3 ^{x} ^{}
 _{=} λ _{1} λ _{2} x _{1} x _{2}  det Hλ _{3} λ _{4} x _{3} x _{4}  det H H _{=} x _{1} x _{2} x _{3} x _{4} 
4 ^{}
λ _{1} λ _{3} x _{1} x _{3}  det Hλ _{2} λ _{4} x _{2} x _{4}  det
x _{1} x _{3} x _{2} x _{4}  ^{.}
1 ^{x} ^{}
_{3} x ^{}
2 ^{x} 4 ^{}
(e) 
Given the previous result, does the cross ratio remain invariant under rotation? brief explanation. 
Give a 
Solution: 

Yes, because rotation matrix is a special case of projective transformation. 

(f) 
Extra Credit 
Show that the result in (??) holds even when x _{i} ^{} = λ _{i} H _{2}_{×}_{2} x _{i} , where points are scaled by
arbitrary scale factors λ _{i} .
5
2
Multiview geometry
Assume that we have two cameras with camera matrices M _{1} and M _{2} . Suppose that the cameras generate image I _{1} and I _{2} , respectively, where p _{1} , p _{2} , p _{3} , p _{4} and p ^{} _{1} , p _{2} ^{} , p ^{} _{3} , p _{4} ^{} are corresponding points across the two images.
(a) Suppose M 1 = K 1 _{} R 1 T 1 _{} M 2 = K 2 _{} R 2 T 2 _{}
(1)
where
K _{1} = K _{2} = K
R _{1} = I = Identity matrix
R _{2} = R
T _{1} = T _{2} = [0, 0, 0] ^{T}
Prove that the homography H deﬁned by
p _{i} ^{} = Hp _{i} where i = 1, 2, 3, 4
(2)
(3)
can be expressed as H = KRK ^{−}^{1} .
Solution:
Consider p and p ^{} are corresponding points in two images whose world coordinate is P . We have
Therefore, we can have
p = K ^{} I
0 ^{} P
p ^{} = KR ^{} I
p ^{} = K ^{} R
0 ^{} P
0 ^{} P
= KR(K ^{−}^{1} K) ^{} I 0 ^{} P
= (KRK ^{−}^{1} )(K ^{} I 0 ^{} P)
= (KRK ^{−}^{1} )p = Hp
(b) Continuing with our setup in part (a). Do N > 3 corresponding points necessarily need to belong to the same planar surface in 3D in order for the above result in part (a) to be true? Justify your answer.
Solution:
No. Notice that in part (a), we did not use any coplanarity constraints.
6
(c) Now we change our setup of two cameras M _{1} and M _{2} as follows.
where
M _{1} = K _{1} ^{} R _{1}
T _{1} ^{}
M _{2} = K _{2} ^{} R _{2}
T _{2} ^{}
(4)
K _{1} = K _{2} = K
R _{1} = I = Identity matrix
R _{2} = R T _{1} = ^{} 0 T _{2} = t = ^{} t _{x}
0
0 ^{} ^{T}
t _{y}
t _{z} ^{} ^{T}
(5)
All four image correspondences p _{i} p _{i} ^{} are projections of four points P _{i} which lie on the same planar surface Π in 3D. Π is deﬁned as the set of points X such that Z ^{T} X = 0, where Z =
1 ^{} ^{T} (v is a 3 × 1 vector). An illustration of this step can be found in Figure ??. Express
the homography H (deﬁned by p ^{} = Hp) in terms of K, R, t, v and explain your derivation.
^{} v ^{T}
Figure 1: Camera setup used in part (c) (d) (e) and (f).
Solution:
To compute H we backproject a point p in the ﬁrst view and determine the intersection point P of this ray with the plane X. The 3D point P is then projected into the second view.
For the ﬁrst view p = K ^{} I
0 ^{} P and so any point on the ray P = ^{K} ^{−}^{1} ^{p} projects to p, where
d parameterizes the point on the ray. Since the 3D point P is on plane X it satisﬁes Z ^{T} P = 0.
d
7
This determines d, and P =
K ^{−}^{1} p
−v ^{T} K
_{−}_{1} _{p} . The 3D point P projects into the second view as
p ^{} = K ^{} R
= ^{} KR
t ^{} P
Kt ^{}
K ^{−}^{1} p
−v ^{T} K
−1 _{p}
= K(R − tv ^{T} )K ^{−}^{1} p
Therefore, we have H = K(R − tv ^{T} )K ^{−}^{1} .
(d) Continuing with our setup in part (c). Prove that the fundamental matrix F which satisﬁes p ^{T} Fp ^{} = 0 can be expressed as
F = ([e _{2} ] _{×} H) ^{T}
where e _{2} (see Figure ??) is the epipole in the second image plane.
Solution:
By the deﬁnition of fundamental matrix, the epipolar line l ^{} in the second image plane should be
l ^{} = F ^{T} p
On the other hand, we can also express l ^{} as
l ^{} = e _{2} × p ^{} = [e _{2} ] _{×} p ^{}
Since p ^{} = Hp, we have F ^{T} = [e _{2} ] _{×} H.
(e) Continuing with our setup in part (c). In addition to the four correspondences on the plane, we are given two additional pairs of corresponding points (p _{5} p ^{} _{5} , p _{6} p _{6} ^{} ) that do NOT belong to the same planar surface Π. Show how to ﬁnd epipole e _{2} and explain your derivation. Hint: e _{2} can be expressed as the intersection of two lines.
Solution:
Suppose the two additional correspondences are {p _{5} , p ^{} _{5} } and {p _{6} , p _{6} ^{} }. e _{2} can be expressed as the intersection of two lines in the second image plane, where these two lines are p _{5} ^{} × Hp _{5} and p _{6} ^{} × Hp _{6} .
8
(f) Continuing with our setup in part (c). From what you have shown in the previous parts, write a function computeF.m that estimates the fundamental matrix F using 6 correpondences (4 of them belong to the same 3D plane).
(a) Image 1
(b) Image 2
Figure 2: Two images from camera M _{1} and M _{2}
We provide
• A dataset of six corresponding points from two images (Figure ??) under the camera setup shown in Figure ??. p1.mat includes six points from image 1 and p2.mat includes six corresponding points from image 2. The ﬁrst four corresponding points are from the same 3D plane, and the last two corresponding points are out of that plane. You can run loadData.m to get familiar with the data.
• Function computeH.m that estimates a homography from at least 4 points.
For this part, you need to turn in
• An outline of the algorithm that you are using to compute F .
• Your code for function computeF.m.
• Your numerical results of F .
Hint:
• You don’t need to (and should not) label additional points.
• You can verify your results by computing p ^{T} Fp ^{} .
Solution: 

function 
F 
= 
computeF( 
pt1, 
pt2 
) 
if 
(size(pt1, 
1) 
~= 
6 
 
size(pt2, 
1) 
~= 
6), 
error(’Wrong 
number 
of points.’); 

end 

9 
H =
computeH(pt1(1:4,
:),
pt2(1:4,
:));
x5 
= 
H 
* 
[pt1(5,:)’; 
1]; 

x5 
= 
x5 
/ 
x5(3); 

x6 
= 
H 
* 
[pt1(6,:)’; 
1]; 

x6 
= 
x6 
/ 
x6(3); 

l1 
= 
cross(x5, [pt2(5,:)’; 
1]); 

l2 
= 
cross(x6, [pt2(6,:)’; 
1]); 

e 
= 
cross(l1, l2); 

e 
= 
e 
/ 
e(3); 

ex 
= 
zeros(3,3); 
ex(1, 
2) 
= 
e(3); 
ex(2, 
1) 
= 
e(3); 
ex(1, 
3) 
= 
e(2); 
ex(3, 
1) 
= 
e(2); 
ex(2, 
3) 
= 
e(1); 
ex(3, 
2) 
= 
e(1); 
F =
(ex
*
H)’;
end
F = 10 ^{4} × −0.0001
−0.0000 0.0000 −0.0008
0.0000
0.0139 −0.0800 −5.2679
0.0899
10
3
Hough Transform and Vanishing Points
For this problem, we wish to ﬁnd the vanishing points of a scene by ﬁnding the intersection point of a set of parallel lines. In Problem Set 1, we selected a pair of parallel lines using 4 points and then extrapolated to ﬁnd their intersection. This process is prone to noise and is sensitive to the selection of points (as many of you complained). To improve this process, we will densely sample many points along a set of parallel lines and use the Hough Transform to better ﬁt lines in the scene. If we parameterize a line using r and
θ as presented in class, we can represent a line as y = ^{−}^{c}^{o}^{s}^{(}^{θ}^{)} x +
. As a result, each edge
point will be mapped to a curve in the polar parameter space by the Hough Transform.
r
sin(θ)
sin(θ)
(a) We will begin by building some intuition about the Hough transform. For the given Cartesian points in the left plot, sketch the corresponding curves in the Hough space. A rough sketch is ok; ensure your sketch captures the fact that there are 10 points that all lie along the same line.
Solution:
(b) 
Once we identify peaks in the Hough space, we can map these back to the Cartesian space. For the given peaks in the Hough space (left plot below), sketch the corresponding lines in the Cartesian space. The sketches can be approximate. 
Solution: 

(c) 
Assuming we densely sample the parallel lines in the scene that correspond to the same vanishing point, we can use the Hough Transform to identify the most likely set of lines. Since there could be multiple parallel lines in the scene, there could be multiple peaks in the Hough space. 
Let the vanishing point lie at x _{0} , y _{0} . The lines in the image that intersect the vanishing point will form peaks in Hough space. Describe the curve in (θ, r) Hough space that all peaks will lie along. Express your answer as a function of the form r _{i} = r(θ _{i} , x _{0} , y _{0} ).
11
Solution:
Since all of the points correspond to lines that should intersect at the same vanish ing point, all of the peaks in the Hough transform should lie along the curve r(θ) = x _{0} cos(θ) _{+} y _{0} sin(θ), which is the equation in Hough space of the set of all lines that go through the vanishing point.
(d) 
If the points selected were from lines that corresponded to more than one vanishing point, what would the peaks in the Hough space look like? Give your answer qualitatively, referencing your solution to (c). 
Solution: 

The intersection points/peaks would represent a point wise sampling of multiple sinusoids, of the form r(θ) = x _{i} cos(θ) _{+} y _{i} sin(θ) for each unique vanishing point, with the x _{i} , y + i being the image coordinates of the vanishing 

(e) 
If we took the locations of the peaks described in part (d) and transformed them back into Cartesian space, how could we use a procedure similar to the Hough transform to ﬁnd the location of the vanishing points? 
Solution: 

Plot lines in Cartesian space corresponding to detected peaks in the Hough parameter space. Then we can quantize the Cartesian space and using the lines found by the hough transform to cast votes for intersection points to ﬁnd the vanishing points. 

(f) 
In the previous parts of this problem we overlooked the size of the bins in the Hough space. If the Hough space had bins of ﬁnite size to act as accumulators for the transformed points, describe the eﬀects of bin size on the procedure described in parts (d) and (e), assuming that the original point sampling of the parallel lines described in part (a) was subject to noise. Speciﬁcally discuss the trade oﬀs that must be considered when selecting bin size. 
12
Solution:
Assuming that the thresholds for the peak detection is proportional to the size of the bins:
Smaller bin sizes more susceptible to noise, since the intersection of the curves or lines in parts e/f could be spread by noise, so there could be spurious peaks detected in neighboring cells. For part e, this would case spurious lines to be found, which would cause even more spread in part f when ﬁnding vanishing points.
Larger bin sizes. are less susceptible to noise causing spurious peaks, however they could result in more coarse detection of peaks since more noisy points could be incorporated in each bin. Also, if lines/points are close together in the parameter spaces, they night get binned together, so some lines and vanishing points may be merged.
Figure 3: Scene with two planes containing parallel lines
(g) Suppose the sets of parallel lines described thus far in this problem belong to N planes, where the number of planes, N , is unknown. Each plane contains multiple sets of parallel lines with diﬀerent directions. A simple illustration of this setup can be seen in Figure ?? with N=2 planes. How might we ﬁnd N , the number of planes in the scene and their normal directions using techniques developed in earlier parts of this question? What additional information might you need? Hint: What properties do vanishing points that belong to the same plane have? Are they geometrically related?
Solution:
We can use Hough transform as described by parts d and e to ﬁnd the vanishing points, some might be spurious because there are many more intersections. All vanishing points for a plane should fall on the the same horizon line (vanishing line). So we can use a
13
Hough transform on these vanishing points to ﬁnd the most likely set of horizon lines. The number of peaks in the Hough transform is an estimate for the number of planes. The horizon lines for each plane can be used to ﬁnd the normal from the expression
→− _{l}
= K ^{−}^{T} ^{→}^{−} n . We would need the camera matrix to ﬁnd the normal.
(h) Extra Credit
One way to estimate the position (x _{0} , y _{0} ) of the vanishing point is to ﬁt a model of the form found in (c) to the n observed Hough peaks that lie at (r _{i} , θ _{i} ). We could then use least squares to minimize the sum of squared errors between the measured r _{i} and that predicted by the model r(θ _{i} , x _{0} , y _{0} ).
min
x _{0} ,y _{0}
n
i=1
(r _{i} − r(θ _{i} , x _{0} , y _{0} )) ^{2}
This is an elegant way to ﬁnd a vanishing point just from the point measurements of the parallel lines in a scene.
Formulate an appropriate objective to describe this problem and solve it using least squares. For this part, you can assume that all peaks in Hough space correspond to lines intersecting at a single vanishing point (x _{0} , y _{0} ) in the image. What is the expression for the optimal vanishing point? Note: it is OK to leave matrix inverses in your solution, but try to simplify other terms as much as possible.
Solution:
n
i=1
n
i=1
Which can be reformed to
cos(θ _{i} ) (r _{i} −
x _{0} cos(θ _{i} ) − y _{0} sin(θ _{i} )) = 0
sin(θ _{i} ) (r _{i} − x _{0} cos(θ _{i} ) − y _{0} sin(θ _{i} )) = 0
n
i=1
n
i=1
cos(θ _{i} ) ^{2} x _{0} +
n
i=1
cos(θ _{i} )sin(θ _{i} ) y _{0} = ^{} cos(θ _{i} )r _{i}
i=1
cos(θ _{i} )sin(θ _{i} ) x _{0} +
n
i=1
sin(θ _{i} ) ^{2}
y _{0} = ^{}
i=1
sin(θ _{i} )r _{i}
i=1 cos(θ _{i} )sin(θ _{i} ) i=1 sin(θ _{i} ) ^{2}
i=1 cos(θ _{i} ) ^{2}
n
n
i=1 cos(θ _{i} )sin(θ _{i} )
n
n
^{} ^{x} ^{o}
y
o
=
i=1 cos(θ _{i} )r _{i}
sin(θ _{i} )r _{i}
i=1
^{} x o
y
o
=
i=1 cos(θ _{i} ) ^{2}
n
i=1 cos(θ _{i} )sin(θ _{i} )
n
i=1 cos(θ _{i} )sin(θ _{i} ) i=1 sin(θ _{i} ) ^{2}
n
n
−1 _{}
i=1 cos(θ _{i} )r _{i}
i=1 sin(θ _{i} )r _{i}
Alternate formulations using SVD are also possible.
14
4
Blob detection
In lecture we learned how we can use a convolution with a Laplacian of a Gaussian to ﬁnd edges in an image. In this question we will explore this idea in more detail.
(a) Suppose that you have the following blackandwhite image. In our image encoding, white is represented by the value of 1 and black the value of 0.
Sketch a onedimensional slice of the intensity (i.e. brightness) of this image in the x direction. Then sketch the result of convolving this signal with the Laplacian of a Gaussian and mark where the edges are located in the plot of the convolution. Your sketches do not need to be scaled correctly because we have not speciﬁed the width of the Gaussian. Please ignore bordereﬀects, i.e. ignore the eﬀect of convolving the kernel with the borders of the image.
Draw your answer here:
Solution:
15
The signal starts at a high intensity / brightness (white), goes to low values (black), and then goes back to high values (white). We therefore draw the signal as starting at 1, going to 0, and going back to 1 (the shape of the graph is the important part here  the scale is arbitrary).
After convolving the signal with the Laplacian of a Gaussian, the response looks like this (ignoring bordereﬀects):
Note that this is the reverse of the response from the lecture slides, since the signal in the lecture slides went from low to high to low, whereas the signal here goes from high to low to high.
(b) Given the following formula for a 2D Gaussian centered at (0, 0):
g =
1
2πσ 2 _{e} −(x ^{2} +y ^{2} )/(2σ ^{2} )
take derivatives and compute the formula for the 2D Laplacian of a Gaussian.
Solution:
First, we have the formula for a 2D Gaussian:
g =
1
2πσ 2 _{e} −(x ^{2} +y ^{2} )/(2σ ^{2} )
Taking the ﬁrst partial derivative:
∂g
∂x _{=} −xg
σ
^{2}
The second partial derivative is then:
Similarly:
∂
^{2} g
∂x ^{2}
∂
^{2} g
∂y ^{2}
_{=}
−g _{+} x ^{2} g
σ
^{2}
σ
^{4}
_{=}
−g _{+} y ^{2} g
σ
^{2}
σ
^{4}
16
So we can write the sum of the partial derivatives as:
Therefore:
∇
∂ ^{2} g
∂x ^{2}
+
∂ ^{2} g
∂y ^{2}
_{=}
(x ^{2} + y ^{2} − 2σ ^{2} )g
σ ^{4}
2 norm ^{g} ^{=} ^{σ} ^{2} ^{(}
∂ ^{2} g
∂x ^{2}
+
∂ ^{2} g
∂y ^{2}
)
(x ^{2} + y ^{2} − 2σ ^{2} )g
_{=}
=
σ ^{2}
1
2πσ 4 _{e} −(x ^{2} +y ^{2} )/(2σ ^{2} ) _{(}_{x} 2 _{+} _{y} 2 _{−} _{2}_{σ} 2 _{)}
(c) Suppose that you convolve a 2D Laplacian of a Gaussian with the following image, where the circle has radius r. Using your answer from parts ?? and ??, ﬁnd the characteristic scale of this image, in terms of the radius of the circle r.
Hint: At the characteristic scale, the convolution will have the same zeros as the Laplacian convolution kernel.
Solution:
From part b, the zeros of the Laplacian occur when
x ^{2} + y ^{2} − 2σ ^{2} = 0
Because the convolution has the same zeros as the Laplacian convolution kernel at the characteristic scale (given in the hint), we want the zeros of the kernel to align with the edges of the image. The edges of the image occur at
x ^{2} + y ^{2} = r ^{2}
Combining the above equations, we get that the characteristic scale occurs at
or
r ^{2} − 2σ ^{2} = 0
σ = r/ ^{√} 2
17
Viel mehr als nur Dokumente.
Entdecken, was Scribd alles zu bieten hat, inklusive Bücher und Hörbücher von großen Verlagen.
Jederzeit kündbar.