Documente Academic
Documente Profesional
Documente Cultură
Lecture Notes
로봇 비젼
강의 노트
Instructor:
Professor
Choi, Tae-Sun
Course outline:
The principles of the machine/robot vision are introduced. It covers image formation,
pattern classification, motion and optical effect for object recognition. In addition, the
design technology of the robot vision system with optical device is studied.
Figure 1—1
1
Figure 1—2
color (ex, R. G. B)
Figure 1—3
2
NTSC : US standard for TV picture and audio coding and transmission
(timing calculation)
For RGB : 3
180 M bit/sec
180
Compression ratio : ≈ 120
1.544
Wavelet compression
MPEG I, II, IV
Compression JPEG
Fractal
H.261
RV
Computer graphics
Image processing
2
Figure 1—4
Figure 1—5
3
“Scene description”
decision marking
1. Microstructure
4
Figure 1—6
“Lambertian Surface”
One that appears equally bright from all viewing directions and reflects all incident light,
absorbing none
5
2. Image Formation & Image sensing
What determines how(Brightness, Color – Photonetiz) bright the image of some surface
will be?
i. Perspective projection
Figure 2—1
6
ii. Orthographic Projection
Figure 2—2
x' = mx x' = x
⇒
y ' = my if m=1 y' = y
=> This orthographic projection can be modeled by rays parallel to the optical axis
(a) (b)
Figure 2—3
δp
E= [watt/m]
δI
7
II. Brightness
2. Scene Brightness :
δ 2P 2
L= L = [watt / m 2 ] where δ P is the power emitted by the infinitesimal surface patch
δ Iδ W
A
SolidAngle ≡ , where A is area, and D is Distance
D2
Ex 1 Hemisphere
4π R 2 1
Solid angle = ⋅ 2 = 2π
2 R
δw Whole sphere = 4π
R
Figure 2—4
Ex 2 Small patch
8
Figure 2—5
Lens
Figure 2—6
9
f(·) : BRDF(Bidirectional Reflectance Distribution Function) in Ch 10
Ex3) Sphere/Radius 2m
Figure 2—7
III. Lenses
Figure 2—8
i. Lens formula
1 1 1
= + 2–1
f z' z
s − z' z'
= 2–2
2R D
10
DS 1 1 1
R= ( − − )
2 f s z
R = 0 at focused point P′
The range of distances over which objects are focused “sufficiently well” in the sense
that thediameter of the blur circle is less than the resolution of the imaging device.
The larger the lens aperture => the less the DOF
Figure 2—9
iii. Vignetting
In a simple lens, all the rays that enter the front surface of the lens end up being focused in the image
Figure 2—10
11
In a compound lens, some of the rays that pass through the first lens may be occluded
power with increasing inclination of light rays with respect to the optical axis
Figure 2—11
iv. Aberration
Points on the optical axis may be quite well focused, which those in a corner of the
12
IV. Image sensing
i. Color sensing
a) Human eye
Figure 2—12
b) CCD sense
R, G, B filter
13
0 (otherwise)
0 (otherwise)
0 (otherwise)
If to every δ, we assign a real number X(δ) The real establish a correspondence rule
between δ and R the real time, such a rule subject to certain constraints is called a
random variable
14
Figure 2—13
R.V.
∞
Where p(x) ≥ 0 for all x, therefore: ∫ p( x)dx = 1
−∞
∞
µ= ∫ xp( x)dx
mean : −∞ : first moment
∞ ∞
δ2 = ∫ ( x − µ ) p( x)dx = ∫x
2 2
p( x)dx : second moment
variance : −∞ −∞
x
P( x) = ∫ p( x)dt
−∞
X = X1 + X 2
Two R.V. R .V . S
Solution
15
Figure 2—14
Given x 2 , x1 : x-x2
P1 ( x1 ) ⋅ δ x1 = P1 ( x − x2 )δ x
∞
∴ P( x) = ∫ P ( x − x ) P ( x )dx
−∞
1 2 2 2 2
∞
=∫ ∫ P ( x − t ) P (t )dt
1 2
−∞
= P1 ∗ P2
N
1
For multiple RV's : x=
N
∑x
i =1
i
Nµ
=µ
Mean value : N
Nσ 2 σ 2
Variance : =
N2 N
σ
Standard Deviation : ⇒
N
b) Gaussian (Normal)
2
1 x−µ
1 −
σ
p.d.f : p ( x) = e 2
2πσ
16
c) Poisson (m>0)
mn
p.d.f : p ( k ) = e− m ⋅
n!
mean = m variance = σ2
1
p y ( y ) = [u ( y + 1) − u ( y − 1)] and Let Z ≡ X + Y , what is the p.d.f of Z?
2
(a) (b)
Figure 2—15
17
∞
p z ( z ) = px ( x ) * p y ( y ) = ∫ p ( z − y) p ( y)dy
−∞
x y
(a) z < −1 ; pz ( z ) = 0
z
1
(b) −1 ≤ z < 1 ; pz ( z ) = ∫ e− ( z − y ) dy
2 −1
1
1 −( z− y )
2 −∫1
(c) z ≥1 ; pz ( z ) = e dy
Figure 2—16
18
3. Binary images : Geometric properties
I. Binary Images
Figure 3—1
x y
1. Area of the object + = 1 ⇒ x sin θ − y cos θ + ρ = 0
ρ ρ
−
sin θ cos θ
1
x=
A ∫ ∫ xb( x, y)dxdy : First moment
1
y=
A ∫ ∫ b( x, y)dxdy
(ρ,θ)
19
II. Simple Geometrical Properties
Figure 3—2
r 2 = ( x − x0 )2 + ( y − y0 )2
= ( x − (− ρ sin θ + s cos θ )) 2 + ( y − ( ρ cos θ + s sin θ ))2
= ( x 2 + y 2 ) + ρ 2 + 2 ρ ( x sin θ − y cos θ ) − 2 s( x cos θ + y sin θ ) + s 2
To find the shortest distance from (x, y) to (x0, y0) differentiate with respect to S and set
equal to zero
d (r 2 )
=0
ds
S = x cosθ + y sin θ
∴ r 2 = ( x − x0 ) 2 + ( y − y 0 ) 2
= ( x sin θ − y cosθ + ρ ) 2
20
If, r=0 , x sin θ − y cosθ + ρ = 0;
At ( x, y ), x sin θ − y cosθ + ρ = 0;
∫∫ r b( x, y)dxdy
2
Finally, E=
dE
d ρ ∫ ∫I
= 2( x sin θ − y cos θ + ρ )b( x, y )dxdy = 0
A( x sin θ − y cosθ + ρ ) = 0
y' = y − y
and so
where,
21
a = ∫ ∫ ( x ')2 b ( x, y )dx ' dy '
I
Now
1 1 1
E= (a + c) − (a − c) cos 2θ − b sin 2θ
2 2 2
b
tan 2 θ =
a−c
1 −1 b
θ = tan
∴ 2 a−c
ρ = − x sin θ + y cosθ
III. Projections
Figure 3—3
22
h( x) = ∫ b( x, y )dy, V ( x) = ∫ b ( x, y )dx
A = ∫ ∫ b( x, y )dxdy = ∫ h( x) dx
Area :
= ∫ v( y )dy
1 1
x=
A ∫ ∫ xb( x, y )dxdy = ∫ xh( x)dx
A
Position :
1
y = ∫ yv( y )dy
A
1 b
Orientation : θ= tan −1
2 a−c
( ρ ,θ ) ρ = − x sin θ + y cosθ
∫ ∫ x b( x, y)dxdy = ∫ x h( x)dx
2 2
I
∫∫ I
y 2b( x, y )dxdy = ∫ y 2v ( x)dy
1 2 1
∫∫ I xyb( x, y )dxdy = ∫ t 2 d (t )dt −
2 ∫ x v( x) − ∫ y 2 h( y )dy
2
Figure 3—4
23
Suppose that θ is 45°
1 1
d (t ) = ∫ b( x, y )dxdy = ∫ b( (t − s ), (t + s )ds
2 2
1
∫∫ I2
( x + y )2 b( x, y )dxdy = ∫ ∫ t 2 d (t )dt
I
1 1
= ∫ ∫ ( x 2 + xy + y 2 )b( x, y )dxdy
I 2 2
1 1
∫ ∫ xyb( x, y)dxdy = ∫ t d (t )dt − 2 ∫ x h( x)dx − 2 ∫ y v( y )dy
2 2 2
so,
I
N M
area A = ∑∑ bij
i =1 j =1
1
i= ∑∑ ibij
A i j
position (i , j )
1
j= ∑∑ jbij
A i j
∑∑ i b
i j
2
ij
orientation ( ρ ,θ ) ∑∑ j
i j
2
bij
∑∑ ijb
i j
ij
24
V. Run-Length coding
Figure 3—5
Where rik is the k-th run of the i-th line and the first run in each row is a run of zeros
mi
n n
2 mi
A = ∑∑ ri , 2 k = ∑ ri 2 + ri 4 + ri 6 + ..........ri
i =1 k =1 i =1 2
25
mi
2
hi = ∑ ri , 2 k
k =1
1 n 1 n
i= ∑
A i =1
i ⋅ hi .......... j = ∑ jv j
A i=1
vj
Figure 3—6
2. The first difference of the vertical projection can be computed from the
26
horizontal differences
3. The vertical projection vj can be found by summing the result from left to right
Orientation (ρ ,θ )
∑i
i
2
hi
∑j
j
2
vj
1 1
∑∑ ijb
i j
ij = ∑ t 2dt −
t
∑
2 i
i 2 h j − ∑ j 2v j
2 j
1
Where, t= (i + j )
2
dt can be obtained in a way similar to that used to obtain the vertical projection
27
4. Binary Image : Topological properties
A simple closed curve separate the image into two simply connected regions
Figure 4—1
Figure 4—2
28
Ex 1
Figure 4—3
4 objects
` 2 backgrounds
Figure 4—4
6 connectedness
29
Figure 4—5
Figure 4—6
Figure 4—7
Recursive Labeling
1. Choose a point where bij=1 and assign a label to this point and into neighbors
30
Figure 4—8
2. Next, label all the neighbors of these neighbors ⇒ one component will have
found where
bij=1
Sequential Labeling
31
Figure 4—9
Figure 4—10
2. if A is one, if D has been labeled, simply copy that label and move on if not [if
one B orc is labeled, copy that label else, choose a new label for A]
(go to step 2)
32
II. Local counting and iterative modification
i. Local counting
Figure 4—11
Horizontal N
33
Figure 4—12
4
Considering all slopes overestimated average ratio :
π
4
Overestimated average rate :
π
-Euler number-
convexities(+1) concavities(-1)
Figure 4—13
34
Figure 4—14
Body hole
1. body - hole : E = 1- 2 = -1 2 - 0 = 2 1 - 0 = 1 1 - 1 = 0 1 - 0 = 1 1 - 0 = 1
Figure 4—15
35
⇒This permits to split an image up into smaller pieces and obtain an overall answer by
combining the
results of1(body) –
operations performed on the pieces
Figure 4—16
1 2 2 2 1
−[ E (a ∩ b ) + E (b ∩ c) + E (c ∩ d ) + E (d ∩ e)]
= (1 + 2 + 2 + 2 + 1) − (1 + 2 + 3 + 2) = 0
convexities =2
36
concavities =2
Ex1) hand
convexit
concavit
Figure 4—17
Euler number = 1
Instead of adding up the outputs of Local operators in the previous section, the new
binary image determined by the iterative method can be used as input to another cycle
37
to incrementally changes an image that is difficult to process into one that might
Euler Differential E*
2. E* = - ( 1 – 1 = 0 ) + ( 1- 0 ) = 1
38
4
*
E new = −E *
39
5. Regions & image segmentation
Figure 5—1
Figure 5—2
40
Figure 5—3
q
R = w1 z1 + w2 z 2 + ⋅ ⋅ ⋅ ⋅ ⋅ + wq z q = ∑ wi z i
i =1
Figure 5—4
i. Point detection
The next level of complexity involves the detection of lines in an image. Consider
41
Figure 5—5
• If at a certain point in the image, |Ri|>|Rj| for all j≠i that point is said to be
more likely associated with a line in the direction of mask i, for example, if
|R1|>| Rj| , for j=2,3,4 the line is more likely associated with a horizontal line.
The idea underlying most edge detection technologies is the computation of a local
derivative operator
Figure 5—6
42
Gradient operator
∂f
∂x
∇f =
∂f
∂y
2 2
∂f ∂f
∇f = +
∂x ∂y
Figure 5—7
Laplacian Operator
∂2 f ∂2 f
∇2 f = +
∂x 2 ∂y 2
∇ 2 f = 4 z 5 − ( z 2 + z 4 + z 6 + z 8 ) in discrete form
Figure 5—8
43
Cross Section of ∇ 2 f
∇ 2 f = 4z5 − (z 2 + z4 + z6 + z8 )
II. Thresholding
Figure 5—9
1 if f ( x, y ) < T
g ( x, y ) =
0 otherwise
i. Basic Formulation
Figure 5—10
44
Let R represent the entire image region and Ri the partitioned region for n=1,2,………n
n
(a) ∪ Ri = R
i =1
(entire image region)
R1 ∩ R5 = φ
R1 ∩ R2 = φ
R ∩ R ≠ φ
1 1
Figure 5—11
“Region Growing” is a procedure that groups pixels or sub-regions into larger regions.
The simplest of these approaches is pixel aggregation, which starts with a set of “seed”
45
Ex 1
Figure 5—12
Spitting
Let R represent the entire image region and select a predicate P as discussed in the
previous section For a square image, one approach for segmenting R is to subdivide it
successively into smaller and smaller quadrant regions so that, for any region Ri,
P(Ri) = TRUE that is, if P(Ri or R) = FALSE, divide the image into quadrants
Figure 5—13
Merging
If only splitting were used, the final partition likely would contain adjacent regions
With identical properties, this draw back may be remedied by allowing merging as well
as splitting two adjacent regions Rj &Rk are merged only if P(Rj∪Rk)=TRUE
Figure 5—14
46
• The preceding discussion may be summarized by the following procedure in
which, at any step, we split into four disjointed quadrants any region Ri where
P(Ri)= FALSE
Figure 5—15
Ex 2
Figure 5—16
Figure 5—17
47
6. Image Processing : Continuous images
Figure 6—1
Double the brightness of ideal image and the defocused image. If the image system
Figure 6—2
Linearity : α f 1( x, y ) + β f 2( x, y ) → α g1( x, y ) + β g 2( x, y )
Shift : f ( x − a , y − b) → g ( x − a, y − b)
48
II. Convolution
f ( x , y ) → h ( x, y ) → g ( x, y )
∞ ∞
g ( x, y ) = ∫∫
−∞ −∞
f ( x − ε , y − η )h(ε ,η )d ε dη
→ g = f ⊗h
Linear α f 1( x, y ) + β f 2 ( ) → h( ) → g ( x, y ) = ?
∞ ∞
g ( x, y ) = ∫ ∫ [α f
−∞ −∞
1( x − ε , y − η ) + β f 2( x − ε , y −η )] ⋅ h(ε ,η )d ε dη
= α g1( x, y ) + β g 2( x, y )
Shift invariant
f ( x − a, y − b) → h( x, y ) → g ( x, y )
∞ ∞
g ( x, y ) = ∫∫
−∞ −∞
f ( x − a, y − b)h(ε ,η )d ε dη
Impulse response
f ( x, y ) → h( x, y ) → h( x, y )
∞ ∞
g ( x, y ) = ∫∫
−∞ −∞
f ( x − ε , y − η )h(ε ,η )d ε dη
and g ( x, y ) = h( x, y )
∞ Origin
Only possible if f ( x, y) =
0 otherwise
This function is called unit impulse δ ( x, y) or Dirac delta function
∞ ∞
∫ ∫ δ ( x, y)dxdy = 1
−∞ −∞
49
∞ ∞
Shifting Property : ∫ ∫ δ ( x, y)h( x, y)dxdy = h(0, 0)
−∞ −∞
∞ ∞
and ∫ ∫ δ ( x − ε , y −η ) ⋅ h(ε ,η )dε dη = h( x, y)
−∞ −∞
Figure 6—3
∞ ∞
f ( x, y) = ∫∫
−∞ −∞
f (ε ,η ) ⋅ δ ( x − ε , y − η )d ε dη
∞ ∞
g ( x, y ) = ∫∫
−∞ −∞
f ( x − ε , y − η ) ⋅ h( x, y )dε dη
∞ ∞
b⊗a = ∫ ∫ a( x − ε , y −η ) ⋅ b( x, y)d ε dη
−∞ −∞
<= Let x − ε = α , y − η = β
∞ ∞
=∫ ∫ a(α , β ) ⋅ b( x − α , y − β )dα d β = b ⊗ a
−∞ −∞
Similarly, (a ⊗ b) ⊗ c = a ⊗ (b ⊗ c)
50
Cascade
f ⊗ h1 ( f ⊗ h 1) ⊗ h 2
f → h1 → h 2 → => f ⊗ (h1 ⊗ h2)
f → h1 ⊗ h2 → g
III. MTF
amplitude.
jwt
e → → A( w)e jwt
→ f ( x, y ) = e 2π i (ux +vy )
∞ ∞
2π i{u ( x −ε ) + v ( y −η )}
g ( x, y ) = ∫ ∫e
−∞ −∞
⋅ h(ε ,η )d ε dη
∞ ∞
= e 2π i (ux +vy ) ∫ ∫e
−2π i ( uε + vη )
⋅ h(ε ,η )d ε dη
−∞ −∞
Represent the signal as an infinite weighted sum of an infinite number of sinusoids (u: angular frequency)
∞
F (u ) = ∫ f ( x ) e−iux dx
−∞
Note:
51
Arbitrary function => Single Analytic Expression
Let g = f ⊗h
Now,
∞ ∞
G (u ) = ∫ ∫ g ( x) e
− i 2π ux
dx
−∞ −∞
∞ ∞
∫ ∫ f (τ ) h ( x − τ ) e
− i 2π ux
= dτ dx
−∞ −∞
∞ ∞
dτ h ( x − τ ) e dx
− i 2π u ( x −τ )
∫ ∫ f (τ ) e
− i 2π uτ
=
−∞ −∞
∞ ∞
= ∫
−∞
f (τ ) e−i 2π uτ dτ ∫
−∞
h ( x ') e −i 2π ux 'dx '
= F (u ) H (u )
g = f ⊗ h ↔ G = FH
g = fh ↔ G = F ⊗ H
52
So, we can find g(x) by Fourier transform
Figure 6—4
Linearity c1 f ( x ) + c2 g ( x ) c1 F ( u ) + c2G ( u )
Scaling f ( ax ) 1 u
F
a a
Shifting f ( x − x0 ) e −i 2π ux0 F ( u )
Symmetry F ( x) f ( −u )
Conjugation f ∗ ( x) F ∗ ( −u )
Convolution f ( x ) ⊗ g ( x) F (u ) G (u )
Differentiation d n f ( x) ( i 2π u )
n
F (u )
n
dx
53
VI. Generalized Functions and Unit Impulses
• The integral of the one-dimensional unit impulse is the unit step function,
x
−∞
∫ δ (t )dt = u ( x) , where u ( x) = 1, for x ≻ 0;
1
= , for x = 0;
2
= 0 , for x ≺ 0 .
∫ ∫ δ ( x, y ) e
− i ( ux + vy )
We have dxdy = 1 , as can be seen by substituting x = 0 and y = 0
−∞ −∞
into e −i ( ux + vy ) , using the sifting property of the unit impulse. Alternatively, we can use
∞ ∞ ε ε
1 1
∫ ∫ δε ( x, y)e ∫ e dx ∫ε e
− i ( ux + vy ) − iux − ivy
lim dxdy , or lim dy ,
ε →0 ε → 0 2ε 2ε
−∞ −∞ −ε −
sin uε sin vε
That is lim =1.
ε → 0 uε vε
g ( x) = f ( x) ∗ h ( x)
Figure 6—5
54
1 1 x2
h (x) = exp − 2
2πσ 2σ
Then
1 2
H ( u ) = exp − ( 2π u ) σ 2
2
G (u ) = F (u ) H (u )
∞ ∞
∂f −2π ux −2π iux ∞
∫−∞ ∂x e dx = f ( x, y)e −∞ − (−2π iu )−∞∫ f ( x, y) ⋅e dx
−2π iux
∞
∞
= f ( x, y)e−2π iux + (2π iu ) ∫ f ( x, y ) ⋅e−2π iux dx
−∞
−∞
In that case,
∞ ∞
∫
−∞
2π iu ∫ f ( x, y )e−2π i (ux +vy ) dxdy = (2π iu ) ⋅ F (u , v)
−∞
∂f ( x , y )
∴F = 2π iu ⋅ F (u , v)
∂x
∂f ( x , y )
F = 2π iv ⋅ F (u , v)
∂x
55
IX. Rotational Symmetry and Isotropic operators
image features in the same way, no matter what their orientation is.
• Circular symmetry
Figure 6—6
Figure 6—7
56
∞ ∞
F { f ( x, y )} = ∫∫
−∞ −∞
f ( x, y)e−2π i (ux+ vy ) dxdy
∞∞
= ∫ ∫ fr (r )e −2π i ⋅r cos(φ −α ) ⋅ rdrd φ
0 0
∞
fr (r ) = 2π ∫ f ρ ( ρ ) J 0(2π r ρ ) ρ d ρ
0
2π
1
∫e
− i ⋅ x cos(θ − w )
where J 0( x) = dθ
2π 0
X. Blurring
1 x2 + y2
1 −
2 σ2
h ( x, y ) = e
2πσ 2
⇓ F .T .
∞ ∞ 1 x2 + y2
1 −
H (u , v) = ∫ ∫ 2πσ
−∞ −∞
2
e 2 σ2
⋅ e−2π i (ux +vy ) dxdy
2 2
∞ 1 x ∞ 1 y
1 − 1 −
2 2 2
∞ 1 x ∞ 1 x ∞ 1 x
1 − − −
∫e ∫e cos(2π ux)dx − i ⋅ ∫ e
2 σ −2π iux 2 σ 2 σ
e dx = ⋅ sin(2π ux)dx
2πσ −∞ −∞ −∞
57
The second integral is odd so, integral over symmetric region is zero.
2
∞ 1 x π 2u 2
− π − 1
∫e
2 σ
And, cos(2π ux)dx = ⋅e a
,a =
−∞
a 2σ 2
2
∞ 1 x 1
− − (2π ) 2 ⋅u 2 ⋅σ 2
∫e
2 σ
cos(2π ux)dx = 2π ⋅ σ ⋅ e 2
−∞
1 1
1 − (2π ) 2 ⋅u 2 ⋅σ 2 1 − (2π ) 2 ⋅v 2 ⋅σ 2
H (u , v) = ⋅ 2πσ ⋅ e 2
⋅ ⋅ 2πσ ⋅ e 2
2π ⋅ σ 2π ⋅ σ
1
− (2π 2 )⋅( u 2 + v 2 ) ⋅σ 2
=e 2
f ( x, y ) → h( x, y ) → h '( x, y ) → f ( x, y )
1
H '(u, v) = min
H (u, v)
,A ,
Where, A is the maximum gain. Or more elegantly, we can use something like
58
H (u , v )
H '(u, v) = ,
H (u, v)2 + B 2
1
where is the maximum gain, if H (u , v ) is real.
(2 B)
XII. Correlation
Figure 6—9
φ ab( x, y ) = a ( x, y )* b( x, y )
∞ ∞
= ∫ ∫ a(ε − x,η − y ) ⋅ b(ε ,η )d ε dη
−∞ −∞
59
XIII. 6.13 Optimal Filtering
Figure 6—10
∞ ∞
i ( x , y ) = b ( x, y ) + n ( x, y )
o ( x, y ) = i ( x, y ) ⊗ h ( x, y )
∞ ∞
∫ ∫ o ( x, y) − 2o( x, y) ⋅ d ( x, y) + d
2 2
So, E = ( x, y )dxdy
−∞ −∞
2
o 2 ( x, y ) = {i ( x, y ) ⊗ h( x, y)}
∞ ∞ ∞ ∞
= ∫ ∫ i( x − ε , y −η ) ⋅ h(ε ,η )d ε dη × ∫ ∫ i( x − α , y − β ) ⋅ h(α , β )dα d β
−∞ −∞ −∞ −∞
Therefore,
∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
x −α = A ⇒ x = A +α
y−β = B⇒ y = B+β
60
∞ ∞
⇒ = ∫ ∫ i( A − (ε − α ), B − (η − β ) ⋅ i( A, B)dAdB
−∞ −∞
= φ ii (ε − α ,η − β ) (Autocorrelation)
61
7. Image Processing – Discrete Image
I. Sampling Theorem
To convert a continuous distribution of brightness to a digital image, it necessary to
extract the brightness at each point arranged at a period. Thus is called sampling.
Figure 7—1
Figure 7—2
62
Suppose a function that is composed by infinite numbers of Dirac’s delta functions
fT ( x) = f ( x) ⋅ combT ( x)
FT { fT ( x )} (v ) = FT { f ( x )} (v ) ⊗ FT {combT ( x )} (v )
1
and, FT {combT ( x )} (v ) = comb T1 (V )
T
1
FT { fT ( x )} (v ) = FT { f ( x )} (v ) ⊗ comb T1 (V )
T
∞ ∞
f (t ) ∗ δ (t ) = ∫ f ( y ) ⋅ δ (t − y )dy = ∫ f (t ) ⋅ δ (t − t )dy = f (t )
−∞ −∞
i.e., convolution of a function and delta function is equal to original function itself.
Since a comb function is a sequence of the delta function arranged at constant period,
63
The F.T. of fT ( x) , which is the sampled version of f ( x ) at period T is an infinite
1
at period .
T
Figure 7—3
If the period of comb function in the frequency domain is sufficiently large, adjacent
can be separated and extracted i.e. no information of the brightness distribution of the
original image is lost by sampling. However, if the internal of the comb function is the
frequency domain is small, adjacent FT { f ( x )} (v)’s overlap. In this case, the original
called aliasing.
64
⇒ FT { fT ( x )} (v ) = FT { f ( x )} (v ) ⊗ FT {combT ( x )} (v )
Figure 7—4
Since the support of FT { f ( x )} is in the range between −Vc ~ Vc , the period has to be at
1
least 2Vc to avoid overlapping of FT { f ( x )} ’s since, T is the sampling period.
T
denote the number of sampling per unit length, i.e. sampling rate consequently, the
sampling rate is more than twice the maximum frequency contained in the original
65
Discrete Fourier Transform (DFT)
∞∞ M −1 N −1 m n
1 −2π i ( u+ v)
F (u, v) = ∫ ∫ f ( x, y)e−2π i (ux +vy ) dxdy =
MN
∑ ∑ f (m, n) ⋅e
m =0 n =0
M N
0 0
(u=0~M-1, v=0~N-1)
M −1 N −1 m n
+2π i ( u+ v)
Inv. D.F.T. = ∑ ∑ F (u , v ) ⋅e M N
(m=0~M-1, n=0~N-1)
m=0 n = 0
1
• Magnitude F (u , v) = R 2 (u , v ) + I 2 (u , v) 2
I (u, v)
Phase Angle φ (u, v) = tan −1
R (u , v )
2
Power Spectrum P (u , v) = F (u , v) = R 2 (u , v) + I 2 (u , v)
M −1 N −1
1
• F (0, 0) =
MN
∑ ∑ f (m, n)
m =0 n = 0
⇒ Average of f (m, n) or D.C. component.
F (u , v ) = F ∗ ( −u , − v )
⇒ Spectrum of D.F.T. is symmetric.
F (u , v) = F ∗ (−u , −v)
66
• Relationship between samples in the spatial and frequency domains.
1 1
△u = △v =
M ⋅ ∆x N ⋅ ∆y
• Translation
u0 v0
− i ⋅2 π ( ⋅x + ⋅ y )
f ( x, y) ⋅ e M N
⇔ F (u − u 0 , v − v 0 )
ux 0 vy 0
− i⋅ 2π ( + )
f ( x − x 0, y − y 0) ⇔ F (u, v)e M N
M N
Case : when u 0 = , v0 =
2 2
x y
i⋅ 2π ( + )
e 2 2
= eiπ ( x + y ) = cos {π ( x + y)} = (−1) x + y
M N
⇒ f ( x, y )( −1) x + y ⇔ F (u − ,v − )
2 2
And similarly,
M N
f (x − , y − ) ⇒ F (u , v)( −1)u + v
2 2
x = r ⋅ cos θ u = w ⋅ cos φ
Rotation
y = r ⋅ sin θ v = w ⋅ sin φ
67
f (r , θ + θ 0 ) ⇔ F ( w, φ + θ 0 )
⇒ Rotating f ( x, y ) by an angle θ 0 rotates F (u, v) by the same angle, and vice versa.
f ( x, y) = f ( x + M , y) = f ( x, y + N ) = f ( x + M , y + N )
M −1 − j 2π u x M −1 − j 2π v y
1 1
Separability F (u , v ) =
M
∑e
x =0
M
⋅
N
∑e
y =0
N
M −1 x M −1 − j 2π v y
1 − j 2π u 1
=
M
∑ F (u , v )e
x =0
M
, (where F (u, v) =
N
∑e
y =0
N )
f (x, y) → F (x, v) → F (u , v )
1-D 1-D
• Convolution
M −1 N −1
1
f ( x, y) ⊗ h( x, y ) =
MN
∑ ∑ f (m, n) ⋅ h( x − m, y − n)
m=0 n =0
f ⊗h ⇒ F ⋅H
→ Pr ove( H .W .)
f ⋅h ⇒ F ⊗ H
68
8. Edge & Edge detection
I. Edges in Images
properties.
• Edges are curves in the image where rapid changes occur in brightness or in the
• Different surfaces
Figure 8—1
69
Figure 8—2
xsinθ − ycosθ + ρ = 0
If t > 0 B1
t<0 B2
t=0 ½(B1 + B2)
t
u (t ) = ∫ δ ( x )dx
−∞
∞
∫−∞
δ ( x)dx = 1
Figure 8—3
∂E
= sin θ ( B1 − B2 )δ ( x sin θ − y cosθ + ρ )
∂x
∂E
= − cosθ ( B1 − B2 )δ ( x sin θ − y cosθ + ρ )
∂y
70
squared gradient
2 2
∂E ∂E
+ = ((B1 − B2 )δ ( x sin θ − y cosθ + ρ ))
2
∂x ∂y
Laplacian of E(x,y)
∂2 E ∂2E
∇2 E = +
∂x 2 ∂y 2
∂2 E
Exx = = sin 2 θ ( B1 − B2 )δ '( x sin θ − y cos θ + ρ )
∂x 2
∂2E
E yy = 2 = cos 2 θ ( B1 − B2 )δ '(a sin θ − y cos θ + ρ )
∂y
∇ 2 E = ( B1 − B2 )δ ' ( x sin θ − y cos θ + ρ )
Ex = E( i+1 , j ) – E( i , j )
Ey = E( i , j+1 ) – E( i , j )
Exx = E( i – 1 , j ) – 2E( i , j ) + E( i + 1 , j )
71
IV. 8.4 Local operators and noise
1
H ' = −ρ 2 ⋅ -------------ⓐ
1+
φ nn
φ bb
ρ2 = u2 + v2
S2
suppose that φ bb = & φ nn = N 2
ρ2
ρ 2S 2
Then H ' = − -ⓐ
S2 + ρ2N 2
S2
at high frequency - << ∞ small gain Noise can be reduced !
N2
Derivation of ⓐ
Figure 8—4
ϕiα ϕbb + ϕ nb
H '' = =
ϕii ϕbb + ϕ bn + ϕ nb + ϕ nn
ϕbb
=
ϕ bb + ϕ nn
1 1
= (= )
1+
ϕ nn SNR
ϕbb
72
For example, if the optimal filter is a gaussian
Figure 8—5
x 2 + y2
1 −
2σ 2
h( x , y ) = 2
e
2πσ
1
− σ 2 (u 2 +v 2 )
H (u,0) = e 2
73
9. Lightness & color
Figure 9—1
• Note that r´(x,y) is constant within a patch and sharp discontinuities at edges
Figure 9—2
Figure 9—3
74
• cut slow slope by a threshold
Figure 9—4
T(∇2b(x,y) = ∇2r(x,y)
• recover r(x,y)
Figure 9—5
∇ 2 l ( x, y ) = t ( x, y )
(l ( x, y ) = ∫ ∫ ∇ 2 r ( x, y ) dxdy
ℑ[∇ 2 l ( x, y )] = ℑ[t ( x, y )]
Fourier Transform : ⇒ − ρ 2 L( ρ ) = T ( ρ )
1
⇒ L( ρ ) = − 2 T (e)
ρ
= G( ρ ) ⋅ T ( ρ )
1
where..G ( p) = −
ρ2
1
g (r ) = log( r ) + ρ
2π
75
Figure 9—6
Figure 9—7
76
b1 ( x, y ) = r1 ( x, y)e1 ( x, y )
b2 ( x, y ) = r2 ( x, y )e2 ( x, y )
b3 = r3 ⋅ e3
b4 = r4 ⋅ e4
b5 = r5 ⋅ e5
. . .
b1 re 37
R1 : = 1 1 = (e1 ≅ e2 ) - equation 9.1
b2 r2 e2 74
r1 26
= - equation 9.2 16
r2 52
b2 28 r
R2 : = = 2 equations
b5 112 r5
b2 38 r2
= =
b3 95 r3
0 ≤ reflectance ≤ 1
77
10. Reflectance Map : photometric stereo
I. Radiometry
δp
irradiance E = geometric stereo (using one camera)
δA
δ2p
radiance L =
δAδW
Figure 10—1
1
⋅ 4π R 2
Solid angle = 2 = 2π
R2
Figure 10—2
78
Figure 10—3
(− p,−q,1)
nˆ =
1 + p 2 + q2
Figure 10—4
79
δO cosθ
solid angle =
( z / cos α ) 2
SI cos α
solid angle =
( S / cos α ) 2
2
δO cosα z
= --------- equation 10.2.1
δI cosθ S
2
α
π cos α 2
π α
Ω=
2
2
= cos 3 α
( z / cosα ) 4 z
Thus the power of the light originating on the patch and passing through the lens is
δP = L ⋅ δOΩ cos θ
where L is the radiance of the surface in the direction toward the Lens
2
π α
δp = LδO cos 3 α cosθ
4 z
2
δP δO π α 3
E= =L cos α cosθ
δI δI 4 z
80
2
π α 4
E=L cos α
4 s
∴E ∝ L
2
π α 4
E = L⋅ cos α
4s
Figure 10—5
Figure 10—6
81
δE (θ i , φ i ) ; irradiance
δ L (θ e , φ e ) : radiance
(θ e , φ e )
δL(θ e , φ e )
f (θ i , φ i ;θ e , φ e ) =
δE (θ i , φ i )
π
π
BRDF : ∫π∫
− 0
2
(θ i ,φ i ;θ e ,φ e ) sin θ e cosθ e dθ e dφ e
=1
Figure 10—7
The.area
solid angle δw = The area = sin θδθ i δφ i
(dis tan ce) 2
82
π
π 2
(proof : ∫ ∫ sw = ∫π ∫ sin θ δθ δϕ
− 0
i i i = 2π
E (θ i , φ i )δω = E (θ i , φ i ) sin θ i δθ i δφ i
π
π 2
E0 = ∫ ∫ E (θ , ϕ ) sin θ cos θ dθ dϕ
−π 0
i i i i i i
where cos θ i accounts for the foreshortening of the surface as seen from the direction
(θ i , φ i )
L(θ e , φ e ) = ∫ ∫ f (θ i , φ i jθ e , φ e ) E (θ i , φ i )
sin θ i cosθ i dθ i dφ i
One that appears equally bright from all viewing directions and reflects all
83
BRDF f (θ i , φ i jθ e , φ e ) constant
π
π 2
∫ ∫ f (θ , φ , jθ , ϕ ) sin θ
−π 0
i i e e e cos θ e dθ e dϕe = 1
π
2
2π f ∫ sin θ e cos θ e dθ e = 1
0
π f =1
1
∴f =
π
L = ∫ ∫ f ⋅ E (θ i , φ i ) sin θ i cosθ i dθ i dφ i
1 1
= f ⋅ Eo = ⋅ E o (∵ f = )
π π
Figure 10—8
84
π
π 2
∫ ∫ f (θ , ϕ ;θ , ϕ ) sin θ
−π 0
i i e e e cos θ e dθ e d ϕe = 1
⇒ k sin θ i cos θ i = 1
1
⇒k =
sin θ i cos θ i
f (θ i , φ i jθ e , φ e ) = δ (θ e − θ i )δ (θ e − φ i − π )
In this case,
sin θ i cosθ i
Determine the radiance of a specular reflecting surface under an extended source where
the irradiance is Eo
π
π 2
δ (θ e − θ i )δ (ϕe − ϕi − π )
L(θ e , ϕ e ) =
− 0
∫π ∫ sin θ i cos θ i
E (θi , ϕi ) ⋅ sin θ i ⋅ cos θ i dθ i d ϕi
= E (θ e , ϕ e − π )
= E (θ i , ϕi )
Figure 10—9
85
1
L= E cosθ i
π
π
π 2
1
L= ∫π ∫ π E ⋅ sin θ cosθ dθ dϕ
− 0
i i i i
π
π 2
E
=
π −π 0
∫ ∫ sin θ cosθ dθ dϕ
i i i i
π
− cos 2θ i 2 E
=E = 2 [1 + 1] = E
2 0
Figure 10—10
86
n = rx × ry = (− p,− q,1)
rx = (δ x ,0, pδ x )T
ry = (0, δ y , qδ y ) T
n (− p,−q ,1) T
nˆ = =
n 1+ p2 + q2
Figure 10—11
vˆ ≡ (0,0,1) T
(− p,− q,1)
nˆ =
1+ p2 + q2
(− p,−q,1) 1
cosθ = nˆvˆ = ⋅ (0,0,1) T =
2 2
1+ p + q 1+ p2 + q2
87
VIII. The reflectance Map
Figure 10—12
sˆ1 → R1 ( p, q )
sˆ 2 → R2 ( p , q )
1
L= E cosθ i for θ i ≥ 0
π
1 + ps p + qs q
R ( p, q ) = = c - equation 10.9.1
1 + p 2 + q 2 1 + p s2 + q s2
Figure 10—13
88
1 + p s p1 + q s q1
R1 ( p, q ) =
1 + p12 + q12 1 + p s2 + q s2
1 + ps p2 + qs q2
R2 ( p , q ) =
1 + p12 + q12 1 + p s2 + q s2
Consider a smoothly curved object the image of such an object will have spatial
variations in brightness due to the fact that surface patches with different orientations
appear with different brightness the variation of brightness is called shading
2
πd
E = L⋅ cos 4 α
4 f
EαLα cosθ i ≡ R( p , q )
E ( x, y) = p ⋅ ( sˆ ⋅ nˆ)
where ρ = 1, E ( x, y ) = sˆ ⋅ nˆ
89
Figure 10—14
sˆ = (0,0,1)
In this case, vˆ = (0,0,1)
(− p,−q,1)
nˆ =
1+ p2 + q2
1 + ps p + qs q
=
2 2
1 + p 2 + q 2 1 + Ps + q s
1
=
1+ p2 + q2
1
d 1 − x
p = z = (r 2 − ( x 2 + y 2 )) 2 (−2 x) = −
dx 2 z − z0
dz y( z − z 0 ) 2
q= =−
dy z − z0
90
1
=
1+ p2 + q2
1
=
x2 + y2
1+
( z − z0 ) 2
x2 + y2
= 1−
r2
(x,y)=(0,0)
E( x, y) maximum = 0
x2+y2 =r2
E(x,y) minimum = 0
X. Photometric stereo
Figure 10—15
91
1 + p s1 p + q s1 q
E1 = R1 ( p, q ) =
2 2
1 + p 2 + q 2 1 + Ps1 + q s1
1 + ps2 p + qs2 q
E 2 = R 2 ( p, q ) =
2 2
1 + p 2 + q 2 1 + Ps 2 + q s 2
1 + p1 p + q1 q
R1 ( p, q ) =
r1
1 + p2 p + q2 q
R2 ( p , q ) =
r2
Figure 10—16
92
XI. Albedo : reflectance factor :
Ei = ρ (sˆi ⋅ nˆ )
(− p i ,−q i ,1) T
where sˆi = for i=1, 2, 3, …………
1 + p i2 + q i2
(− p,−q,1)T
nˆ =
1+ p2 + q2
Figure 10—17
Unknown variables p, q, ρ
At least 3 equations
93
11. Reflectance Map : shape from shading
Figure 11—1
i. Picture
One more information => strong constraint smoothness neighboring patches of the
surface => similar orientation assumption of smoothness : strong constraint
Figure 11—2
94
b a b
tan θ 0 = cosθ 0 = sin θ 0 =
a a +b 2 2
a + b2
2
Figure 11—3
Figure 11—4
95
δz = mδξ (small change a long the characteristic curve)
δz 1
m= = f −1 ( E ( x, y ))
δξ 2
a +b 2
Figure 11—5
96
q
tan θ s =
p
p
cosθ s =
p + q2
2
q
sin θ s =
p + q2
2
= p2 + q2
= f −1 ( E ( x, y ))
The change in Z
−1
δz = mδξ = p2 + q2 ⋅ f ( E ( x, y))δξ
p
δx = cosθ sδξ = δξ
p + q2
2
q
δy = sin θ s δξ = δξ
p + q2
2
1
To simplify δz , we could take a step of length δξ rather than δξ
p + q2
2
δz = p2 + q2 × p2 + q2
= ( p 2 + q 2 )δξ
= f −1 ( E ( x, y ))δξ
δy = qδξ
97
We need to determine p&q at the new point in order to continue the solution
E ( x, y) = f ( p 2 + q 2 )
Differentiate E ( x, y ) w, r , t x & y
∂E ∂E ∂S ∂S
Ex = = ⋅ = f ' (S )
∂x ∂S ∂x ∂x
2 2
where S = p + q
∂s ∂p ∂q ∂z ∂z
= 2p + 2q , p = , q =
∂x ∂x ∂x ∂x ∂y
∂2 z ∂2z
= 2p + 2 q
∂x 2 ∂x∂y
Ex = 2( pr + qs ) f '( s )
E y = 2( ps + qt ) f '( s) - equation 11.1.2
∂p ∂p ∂ 2 z ∂2 z
δ p = δx+ = 2 δx+ δy
∂q ∂y ∂x ∂x∂y
= rδx + sδy
δq = sδx + tδy
δp = ( pr + qs) ⋅ δξ
δq = ( ps + qt ) ⋅ δξ
Ex
δp = δξ
2f'
From (2)
Ey
δq = δξ
2f'
98
xɺ = p, yɺ = q, zɺ = p 2 + q 2 = f −1
( E ( x, y))
Ex Ey
pɺ = , qɺ =
2f' 2f'
5 Differential Eqs
xɺ = p, yɺ = q, w.r.t ξ
Ex Ey
ɺxɺ = pɺ = , ɺyɺ = qɺ =
2f' 2f'
zɺ = f −1 ( E ( x, y ))
δz = pδx + qδy
∂2 z ∂2 z
δp = δ x + δy - equation 11.1.3
∂x 2 ∂x∂y
= rδx + sδy
∂2 z ∂2z
δq = δx + 2 δy
∂x∂y ∂y
= sδx + tδy
99
δp r s δx δx
= = H ⋅
δq s t δy δy
∂2 z ∂2 z
r+t = + : Laplacian
∂x 2 ∂y 2
∂E ∂E ∂p ∂E ∂q
Ex = = ⋅ + ⋅
∂x ∂p ∂x ∂q ∂x
∂2 z ∂2z
= Rp ⋅ + Rq ⋅ S
∂x 2 ∂x∂y
= R p ⋅ r + Rq ⋅ S
E y = R p ⋅ S + Rq ⋅ t
Ex R
= H ⋅ p - equation 11.1.4
E R
y q
δx Rp
Let = ⋅ δξ
δy Rq
xɺ = R p
yɺ = Rq
δp δx R p Ex
Then = H ⋅ = H ⋅ = δξ
δq δy Rq E y
100
xɺ = R p
yɺ = Rq , zɺ = pR p + qRq
δz = p ⋅ δx + q ⋅ δy zɺ = pxɺ + qyɺ = pR p + qRq
δξ δξ δξ
pɺ = E x , qɺ = E y
Figure 11—6
Figure 11—7
Figure 11—8
101
Rp = 0, Rq = 0
xɺ = Rp = 0, yɺ = Rq = 0
1 2
R( p, q) = ( p + q 2 ) - equation 11.3.1
2
1
z = z0 + (ax 2 + 2bxy + cy 2 )
2
dz
Thus p = = ax + by
dx
dz
& q= = bx + cy
dy
1 2 1
R( p, q) = ( p + q 2 ) = [(ac + by) 2 + (bx + cy ) 2 ]
2 2
1 2 1
= (a + b 2 ) x 2 + (a + c)bxy + (b 2 + c 2 ) y 2
2 2
E x = (a 2 + b 2 ) x + (a + c)by
E y = (a + c)bx + (b 2 + c 2 ) y
Differentiating again,
E = a 2 + b 2
xx
E xy = (a + c)b 3 equations, 3 unknowns
2 2
E yy = b + c
102
III. Stereo graphic projection
Figure 11—9
b f 2 + q2
=
R + a 2R
2 2
b = ( p + q )
a R
2 2 2
a + b = R
2p 2q
f = ,g =
1+ 1+ p2 + q2 1+ 1+ p2 + q2
conversely
4f 4g
p= 2 2
,q =
4− f − g 4 − f 2 − g2
103
IV. 11.7 Relaxation methods
E(x , y) = R(p , q)
= Rs(f,g)
Minimize
e s = ∫ ∫ ( f 2 + fy 2 ) + ( gx 2 + gy 2 )dxdy
A low, Minimize
ei = ∫ ∫ ( E ( x, y ) − Rs ( f , g )) 2 dxdy
λis large
λis small
104
minimize ∫∫ I F ( f , g , f x , f y , g x , g y )dxdy
∂ ∂
Ff − Ffx − Ff y = 0
∂x ∂y
∂ ∂
Fg − Fg x − Fg y = 0
∂x ∂y
2 2 2 2
F = ( f x + f y ) + ( g x + g y ) + λ ( E ( x, y) ⋅ Rs ( f , g )) 2
∂Rs
F f = −2λ ( E ( x, y) − Rs ( f , g ))
∂f
∂ ∂
F fx = ⋅ (2 f x ) = 2 f xx
∂x ∂x
∂
F f = 2 f yy
∂y y
∂ ∂
2( f xx + f yy ) = Ffx + Ffy = F f
∂x ∂y
∂Rs
= −λ ( E ( x, y ) − Rs ( f , g ))
∂f
∂Rs
∇ 2 g = −λ ( E ( x, y ) − Rs ( f , g )) (2 equations, 2 unknowns(f,g))
∂g
105
n
e = ∫ ∫ I (( fx 2 − f y ) + ( g x + g y ))dxdy + ∑ λi ∫ ∫ I ( Ei ( x, y ) − Ri ( f , g )) 2 dxdy
2 2 2
i =1
where Ei(x,y) is the brightness measured in the i th image and Ri is the corresponding
reflectance map
n
∂Ri
∇ 2 f = −∑ λi ( Ei ( x, y) − Ri ( f , g ))
i =1 ∂f
n
∂Ri
∇ 2 g = −∑ λi ( Ei ( x, y ) − Ri ( f , g ))
i =1 ∂g
Figure 11—10
106
Figure 11—11
( x, y )
z ( x, y ) = z ( x0 , y0 ) + ∫
( x0, y 0)
( pdx + qdy )
∫ ∫ (( z
I x − p ) 2 + ( z p − p ) 2 )dxdy
where p and q are the given estimates of the components of the gradient while z x & z y
Minimize ∫∫ I F ( z , z x , z y )dxdy
∂ ∂
Fz − Fz x − Fz y = 0
∂x ∂y
107
so that from F = ( z x − p ) 2 + ( z y − q ) 2
∂ ∂
Fz = Fz x + Fz y
∂x ∂y
∂ ∂
= 2 ⋅ ( z x − p) + 2 ⋅ ( z y − q )
∂x ∂y
=0
2( z xx − p x ) + 2( z yy − q y ) = 0
z xx + z yy = p x + q y
(∇ 2 z = p x + q y )
108
12. Motion field & Optical flow
Figure 12—1
I. Motion Field
Figure 12—2
109
δr δr
v0 = 0
, &v i = i
δt δt
- equation 12.1.1
ri r
= 0
f ' r 0 ⋅ zˆ
dr dr
d r (r0 ⋅ zˆ) 0 − ( 0 ⋅ zˆ)r 0
1 i dt dt
⋅ = 2
f ' dt (r0 ⋅ zˆ)
(r ⋅ zˆ)v0 − (v0 ⋅ zˆ)r0
= 0
(r 0 ⋅ zˆ) 2
1 (r × v ) × zˆ
⋅ vi = 0 0 2 - equation 12.1.2
f' (r0 ⋅ zˆ)
Figure 12—3
110
Ex1)
Figure 12—4
E(x, y, t) ≡ E(x + uδt , y + vδt , t + δt) where u(x, y) & v(x, y) are the x & y components
of the optical flow vector
∂E δx ∂E δy ∂E δt
⋅ + ⋅ + ⋅ =0
∂x δt ∂y δt ∂t δt
u, v : two variables
one equation :
⇒ one more constraint needed
Usually, the motion field varies smoothly minimize a measure of departure from
smoothness
111
e s = ∫ ∫ ((ux 2 + uy 2 ) + (vx 2 + vy 2 ))dxdy
Minimize e s + λec
ec = ∫ ∫ ( E x u + E y v + Et ) 2 dxdy
λ: a parameter that weights the error in the image motion equation relative to the
departure
from smoothness
λ=> Large
=> small
Minimize ∫ ∫ F ( u , v, u x , u y , v x , v y )dxdy
F = (u X2 + u Y2 ) + (v x2 + v y2 ) + λ ( E x u + E y v + Et ) 2
∂ ∂
Fu − Fu x − Fu y = 0
∂x ∂y
∂ ∂
Fv − Fvx − Fv y = 0
∂x ∂y
112
Fu = 2λ ( E x u + E y v + Et ) E x
∂ ∂
Fu x = (2u x ) = 2u xx
∂x ∂x
∂ ∂
Fu y = (2u y ) = 2u yy
∂y ∂x
λ ( E x u + E y v + Et ) E x = u xx + u yy = ∇ 2 u
Similarly,
λ ( E x u + E y v + Et ) E y = ∇ 2 v
E x u + E y v + Et = 0
dy dx
Fu x = Fu y
ds ds
dy dx
Fv x = Fv y
ds ds
T
dy dx
nˆ = ,− is a unit vector
ds ds
( Fu x , Fu y ) ⋅ nˆ = 0
( Fv x , Fv y ) ⋅ nˆ = 0
113
in our case, F = (u x2 + u 2y ) + (v x2 + v 2y ) + λ ( E x u + E y v + Et ) 2
(u x , u y ) ⋅ nˆ = 0
(v x , v y ) ⋅ nˆ = 0
V. Discrete case
From e = es + λec
e = ∑∑ ( sij + λ cij )
i j
1
si , j = ((u i +1, j − ui , j ) 2 + (u i, j +1 − ui , j ) 2 + (vi +1, j − vi , j ) 2 + (vi , j +1 − vi , j ) 2 )
4
cij = ( E x u ij + E y vij + Et ) 2
∂e
= 2(u kl − u kl ) + 2λ ( E x u kl + E y vkl + Et ) E x ,
∂u kl
∂e
= 2(v kl − vkl ) + 2λ ( E x u kl + E y v kl + Et ) E y ,
∂v kl
114
∂e
=0
∂u kl
solve this
∂e
=0
∂v kl
Iterative scheme is
n +1 n
E x u kln + E y vkln + Et
u kl =u −
kl Ex ,
1 + λ ( E x2 + E y2 )
E x u kln + E y vkln + Et
v kln+1 = vkln − Ey .
1 + λ ( E x2 + E y2 )
Figure 12—5
115
13. Photogrammetry & Stereo
Figure 13—1
b
x+
xl' 2 ← (blue line) − (1)
=
f z
b
x−
x r' 2 ← (red line) − (2)
=
f z
' '
y yl yr
= = − (3)
f f z
b
( xl' − xr' ) =
f : disparity
z
(x' − x' ) / 2 (y' − y' ) / 2 bf
x = b l ' r ' ,y =b l ' r ' ,z = '
xl − x r xl − x r xl − x r'
116
1 1
z∝ ' '
=
x − xr D
l
II. Photogrammetry
Figure 13—2
xr
• absolute orientation
(rl , rr , known )
xr
y r r = Rr l + r0
r
z r
rotaional translational
component component
r11 r12 r13 r14
r r22 r23 r
21 24
r31 r32 r33 r34
117
where R is a 3*3 orthonormal matrix
RT ⋅ R = I
• Orthonormality
RT ⋅ R = I
Figure 13—3
118
rl 2 − rl1 = rr 2 − rr1
3+7 = 10 equations
12 unknown variables
Figure 13—4
r r = R ⋅ r l + r 0 - equation 13.3.1
The projection points ( xl' , y l' ) & ( x r' , y r' ) known determine the ratios of x and y to z
using
119
xl' xl y' y
= & l = l
f zl f zl
- - equation 13.4.1
x r' xr y r' y
= & = r
f zr f zr
12 + 2*(n)
substitute B into A
f z x
r11 xl' + r12 y l' + r13 f + r14 = x r' r = r
zl zl s
f z y
⇒ r21 xl' + r22 y l' + r23 f + r24 = y r' r = r - equation 13.3.2
zl zl s
f z
r31 xl' + r32 y l' + r33 f + r34 = f r =
zl zl
7 + 3n ; # of equations
120
1 0 0 2
r =1
R ⋅ R = I 0 1 0 i
T
r r = 0 if i ≠ j
0 0 1 i j
∴12 + 2n = 7 + 3n
n=5
n ≥5
x r' x as + u
= r =
f z r cs + w
y r' y bs + v
= r =
f z r cs + w
121
V. Computing depth
Once IR , r 0 , ( xl' , y l' ), ( x r' , y r' ) known, The depth ( z l , z r ) can be computed
as follows
Figure 13—5
zl
From equation 13.3.2, multiply by
f
x' y '
r l = ( xl , yl , z l ) T = l , l ,1 z l
f f
x' y'
r l = ( x r , y r , z r ) T = r , r ,1 z r
f f
122
VI. 13.7 exterior orientation
Figure 13—6
rc = R ⋅ra + r0
R T ⋅ R = I (orthonormality)
x' xc y' y
= & = c
f zc f zc
x' xc r11 x a + r12 y a + r13 z a + r14
= =
f z c r31 x a + r32 y a + r33 z a + r34
- equation 13.7.1
y ' y c r21 xa + r22 y a + r23 z a + r24
= =
f z c r31 x a + r32 y a + r33 z a + r34
# of equations = 2n +6
# of unknowns = 12
2n+6 = 12 => n=3 (at least we need three equations)
123
VII. Interior Orientation
• scaling error
• translation error
• skewing error
• shearing error
An affine transformation
xc y
x' = a11 ( ) + a12 ( c ) + a13
zc zc
xc y
y' = a 21 ( ) + a 22 ( c ) + a 23
zc zc
T
Rsij ⋅ Rsij ≠ I 12 unknowns
#of equations = 2n
∴ 2n=12 ; n=6
124
VIII. Finding conjugate points
i. Gray-Level Matching
b b
x+ x−
xl' x '
2& r = 2
=
f z f z
at a matched point
b b
x+ x−
E ~ El ( f 2 , y' ) = E ( f 2 , y' )
r
z z
(∵ y l ≅ y r = y )
' '
x' x bf
Let ≅ & d ( x' , y' ) =
f z z
1 1
El ( x'+ d ( x' , y ' ), y' ) = E r ( x'− d ( x' , y ' ), y' )
2 2
ei = ∫ ∫ ( El − Er ) 2 dx' dy '
∂ ∂
Fd − Fd 'x − Fd ' = 0
∂x' ∂y' y
where
125
1 1
F = (∇ ⋅ ∇d ) 2 + λ[ El ( x'+ d ( x' , y' ), y ' ) − E r ( x'− d ( x' , y ' ), y ' )]2
2 2
∂E () 1 1 ∂E ()
Fd = 2λ[ El ( ) − E () − E r ()][ l ( ) − (− ) r ]
∂x' 2 2 ∂x'
1 ∂El ∂E r
=2λ[ El () − E r ()] [ + ]
2 ∂x' ∂x'
∂ ∂
Fdx ' + Fdy ' = 2∇ 2 (∇ 2 d )
∂x' ∂y'
1 ∂E () ∂E ()
∵ ∇ 2 (∇ 2 d ) = λ[ El () − E r ()] [ l + r ]
2 ∂x' ∂x'
126
14. Pattern classification
Reference – “ Pattern Classification & Scene Analysis”
Dudda & Hart (Wiley Interscience pub. C)
Figure 14—1
f x (x :θ )
127
The joint lpdf of X 1 , X 2 ,........X n is f x1
The maximum likelihood estimation (MLE) θˆ is that value that maximizes the LF, that
is
n
1
exp − 1 2
h
L( X ; µ ) =
2
2σ
∑ (x i − µ)2
2πσ i =0
since the log function is monotonic, the maximum of L(x ; μ) is also that of log L(x ; μ)
n
n 1
Hence log L( x; µ ) = − log(2πσ 2 ) −
2 2σ 2
∑ (x
i =1
i − µ)2
∂ log L( x; µ )
Set =0
∂u
n
1 1 n
This yields
∂2
∑ ( xi − µ ) = 0 µ̂ =
i= 0
∑ xi
n i =1
128
n
1 1
f x ( x, µ , σ 2 ) =
2
exp(−
2σ 2 ∑ (x − µ) 2
)
2πσ i =1
∂L ∂L
Now set = 0, =0
∂µ ∂σ
∑ (x
i =1
i − µ) = 0
n
n 1
−
σ
+
σ3
∑ (x
i =1
i − µ) 2 = 0
1 n
Hence µ̂ = ∑ Xi
n i =1
1 n
σˆ 2 = ∑
n i=1
( xi − µˆ ) 2
Suppose that an classifier to separate two kinds of lumber, ash and birch
Figure 14—2
129
A prior : • probability p(w1) : the next piece is ash
Decide w2 otherwise
Bay’s Rule ;
p( x | w j ) ⋅ p(w j )
p( w j | X ) =
p ( x)
r
where p ( x) = ∑ p ( x | w j ) ⋅ p ( w j )
j =1
Decide w2 otherwise
Decide w2 otherwise
130
Decide w1 if p(x| w1) > p(x| w2)
Decide w2 if otherwise
Figure 14—3
∞
p (error ) = ∫ p(error , x)dx
−∞
∞
= ∫ p(error | x) p( x)dx
−∞
p ( w1 | x) if we decide w2
where p(error|x)
p ( w2 | x) if we decide w1
Figure 14—4
131
(B-1) Generalized Form (for Bayes classifier)
Let Ω = {w1 ..........ws } be the finite set of S states of nature and A = {α 1 ........α a ) be the
Let λ (α i | w j ) be the loss incurred for taking action α i when the state of nature is w j
p( x | w j ) p( w j )
Then p ( w j | x) =
p( x )
s
Where p ( X ) = ∑ p ( x | w j ) p (w j )
j =1
Target: to find a Bayes decision rule against p(wj) that minimizes the overall risk
R = ∫ R(α ( x) | x) ⋅ p ( x)d x
clearly, if α (x) is chosen so that R(α ( x) | x) is as small as possible, for every X , then
the overall risk will be minimized Bayes decision rule for the general form; to minimize
132
1.Compute the conditional risk
s
R(α i | X ) = ∑ λ (α i | w j ) ⋅ p ( w j | X )
j =1
for i=1,………..a
Let λ ij = λ (α i | w j ) the loss incurred for deciding wi when the true state of nature is wj.
Decide w2 otherwise
If we substitute 1 into 2
We have
133
Figure 14—5
1 i≠j
= 1 − p ( wi | X )
To minimize the average prob of error, we should select the i that maximizes the a
posterior prob
134
A pattern classifier
Figure 14—6
p ( X | wi ) p (w j )
= c
by Bayes rule
∑ p( X | w ) p(w
j =1
j j )
⇒ p ( X | wi ) p ( wi )
⇒ log p ( X | wi ) + log p ( wi )
Decision Rule
135
In other words, assign X to wI
= P( X 0 w2 ) P( w2 ) + P( x0 w3 ) P( w3 )
Total error
∞
P(error) = ∫ P(error , x)dx
−∞
136