3-d computer vision csc 83020 – ioannis stamos 3-d computer vision csc 83020 binary images horn...
TRANSCRIPT
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
3-D Computer Vision3-D Computer VisionCSc 83020CSc 83020
Binary ImagesBinary Images
Horn (Robot Vision): pages 46-64.Horn (Robot Vision): pages 46-64.
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Binary ImagesBinary Images
Binary Image b(x,y): Obtained from Gray-Level (or other image) g(x,y)By Thresholding.
Characteristic Function: 1 g(x,y) < T
b(x,y)= 0 g(x,y) >= T
1) Geometrical Properties2) Discrete Binary Images3) Multiple objects4) Sequential and Iterative Processing.
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Selecting the Threshold (T)Selecting the Threshold (T)
g(x,y)
HISTOGRAM
h(i)
T i (intensity)
BIMODAL
b(x,y)
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Histogram ThresholdingHistogram Thresholding
T
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Geometric PropertiesGeometric PropertiesAssume:
1) b(x,y) is continuous2) Only one object
y
x
b(x,y)
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Geometric PropertiesGeometric PropertiesAssume:
1) b(x,y) is continuous2) Only one object
y
x
b(x,y)
Area:
I
dxdyyxbA ),( (Zeroth Moment)
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Geometric PropertiesGeometric PropertiesAssume:
1) b(x,y) is continuous2) Only one object
y
x
b(x,y)
Area:
I
dxdyyxbA ),( (Zeroth Moment)
Position: “Center” (x,y) of Area
I
I
dxdyyxbyAy
dxdyyxbxAx
),(*)/1(
),(*)/1(
_
_(First Moment)
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
OrientationOrientationDifficult to define!We use axis of least second moment
(x,y)
r
ρ
θ
axisy
x
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
OrientationOrientationDifficult to define!We use axis of least second momentFor mass distribution: Axis of minimum Inertia.
(x,y)
r
ρ
θ
axisy
x
Minimize: I
dxdyyxbrE ),(2
OrientationOrientationDifficult to define!We use axis of least second momentFor mass distribution: Axis of minimum Inertia.
(x,y)
r
ρ
θ
axisy
x
Minimize: I
dxdyyxbrE ),(2
Equation of Axis: y=mx+b ??? 0<= m <= infinity
We use: (ρ, θ) finite.Find (ρ, θ) that minimize E for a given b(x,y)
0)cos()sin( yx
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
We can show that:22 ))cos()sin(( yxr
So: dxdyyxbyxEI
),())cos()sin(( 2
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
We can show that:22 ))cos()sin(( yxr
So: dxdyyxbyxEI
),())cos()sin(( 2
Using dE/dρ=0 we get: 0))cos()sin((__
yxA
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
We can show that:22 ))cos()sin(( yxr
So: dxdyyxbyxEI
),())cos()sin(( 2
Using dE/dρ=0 we get: 0))cos()sin((__
yxA
Note: Axis passes through center (x,y)!!
So, change coordinates: x’=x-x, y’=y-y
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
We can show that:22 ))cos()sin(( yxr
So: dxdyyxbyxEI
),())cos()sin(( 2
Using dE/dρ=0 we get: 0))cos()sin((__
yxA
Note: Axis passes through center (x,y)!!
So, change coordinates: x’=x-x, y’=y-y
We get:
I
I
I
dydxyxbyc
dydxyxbyxb
dydxyxbxa
cbaE
''2'
''''
''2'
222
),()(
),()(2
),()(
)(cos)cos()(sin)(sin
Second Momentsw.r.t.(x, y)
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
We can show that:22 ))cos()sin(( yxr
So: dxdyyxbyxEI
),())cos()sin(( 2
Using dE/dρ=0 we get: 0))cos()sin((__
yxA
Note: Axis passes through center (x,y)!!
So, change coordinates: x’=x-x, y’=y-y
We get:
I
I
I
dydxyxbyc
dydxyxbyxb
dydxyxbxa
cbaE
''2'
''''
''2'
222
),()(
),()(2
),()(
)(cos)cos()(sin)(sin
Second Momentsw.r.t.(x, y)
Mistake inyourhandout.
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
)(cos)cos()(sin)(sin 22 cbaE
Using dE/dθ=0, we get: tan(2θ)=b/(a-c)
2θ
b
a-c
22 )( cab
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
)(cos)cos()sin()(sin 22 cbaE
Using dE/dθ=0, we get: tan(2θ)=b/(a-c)
So: 2θ
b
a-c
22 )( cab
22
22
)(/)()2cos(
)(/)2sin(
cabca
cabb
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
)(cos)cos()(sin)(sin 222 cbaE
Using dE/dθ=0, we get: tan(2θ)=b/(a-c)
So:
Solutions with positive sign may be used to find θ that minimizesE (why??).
Emin/Emax -> (ROUDNESS of the OBJECT).
2θ
b
a-c
22 )( cab
22
22
)(/)()2cos(
)(/)2sin(
cabca
cabb
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Discrete Binary ImagesDiscrete Binary Imagesbij: value at pixel in row i & column j.
1 11 1 1 1 1
1 1 1 1 11 1 1 1
1
O j (y) m
i(x)
n
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Discrete Binary ImagesDiscrete Binary Imagesbij: value at pixel in row i & column j. Assume pixel area is 1.Area:
Position (Center of Area):1 1
1 1 1 1 11 1 1 1 1
1 1 1 11
O j (y) m
i(x)
n
n
i
m
jijbA
1 1
n
i
m
jij
n
i
m
jij
jbAy
ibAx
1 1
_
1 1
_
)/1(
)/1(
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Discrete Binary ImagesDiscrete Binary Imagesbij: value at pixel in row i & column j. Assume pixel area is 1.Area:
Position (Center of Area):1 1
1 1 1 1 11 1 1 1 1
1 1 1 11
O j (y) m
i(x)
n
n
i
m
jijbA
1 1
n
i
m
jij
n
i
m
jij
jbAy
ibAx
1 1
_
1 1
_
)/1(
)/1(
n
i
m
j
n
i
m
jijij
n
i
m
jij bjcbijbbia
1 1 1 1
2''
1 1
2' ,2,
Second Moments.
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Discrete Binary Images (cont)Discrete Binary Images (cont)
Note: a’,b’,c’ are second moments w.r.t ORIGINa,b,c (w.r.t “center”) can be found from
(a’,b’,c’,x,y,A).
Note: UPDATE (a’,b’,c’,x,y,A) during RASTER SCAN.
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Multiple ObjectsMultiple ObjectsNeed to SEGMENT image into separate COMPONENTS (regions).
Connected Component:Maximal Set of Connected Points:
B
A
Points A and B are connected: Path exists between A andB along which b(x,y) is constant.
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Connected ComponentsConnected Components
Label all pixels that are connected
4-way connected 8-way connected
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Region Growing AlgorithmRegion Growing Algorithm(Connected Component Labeling)(Connected Component Labeling)
Start with “seed” point where bij=1.Start with “seed” point where bij=1. Assign LABEL to seed point.Assign LABEL to seed point. Assign SAME LABEL to its NEIGHBORS (b=1).Assign SAME LABEL to its NEIGHBORS (b=1). Assign SAME LABEL to NEIGHBORS of NEIGHBORS.Assign SAME LABEL to NEIGHBORS of NEIGHBORS.
Terminates when a component is completely labeled.Then pick another UNLABELED seed point.
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
What do we mean by NEIGHBORS?What do we mean by NEIGHBORS?Connectedness
4-Connectedness (4-c)
8-Connectedness (8-c)
Neither is perfect!
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
What do we mean by NEIGHBORS?What do we mean by NEIGHBORS?
Jordan’s Curve Theorem: Closed curve -> 2 connected regions
0 1 0
1
1
10
00
B1 O1 B1
O2
O4
O3B2
B1B1(4-c)Hole without closed curve!
What do we mean by NEIGHBORS?What do we mean by NEIGHBORS?
Jordan’s Curve Theorem: Closed curve -> 2 connected regions
0 1 0
1
1
10
00
B1 O1 B1
O2
O4
O3B2
B1B1
B O B
O
O
OB
BB(4-c)Hole without closed curve!
(8-c)Connected background
with closed ring!
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Solution: Introduce AssymetrySolution: Introduce AssymetryUse: or
0 1 0
1
1
10
00
B O1 B
O2
O2
O1B
BB
(a) (b)
Using(a)
Two separate linesegments.
HexagonalTesselation
Above assymetry makesSQUARE grid likeHEXAGONAL grid.
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Sequential Labeling AlgorithmSequential Labeling Algorithm
A
BD
C
Raster Scan
Note: B,C,D are already labeled
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Sequential Labeling AlgorithmSequential Labeling Algorithm
A
BD
C
Raster Scan
Note: B,C,D are already labeled
0
XX
X
a. Label(A) = background
1
XD
X
b. Label(A) = label(D)
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Sequential Labeling AlgorithmSequential Labeling Algorithm
A
BD
C
Raster Scan
Note: B,C,D are already labeled
1
00
C
c. Label(A) = label(C)
1
B0
0
d. Label(A) = label(B)
1
B0
C
d. If Label(B) = label(C ), then Label(A)=Label(B)= Label(C)
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Sequential Labeling AlgorithmSequential Labeling Algorithm
A
BD
C
Raster Scan
Note: B,C,D are already labeled
0
XX
X
a. Label(A) = background
1
XD
X
b. Label(A) = label(D)
1
00
C
c. Label(A) = label(C)
1
B0
0
d. Label(A) = label(B)
1
B0
C
d. If Label(B) = label(C ), then Label(A)=Label(B)= Label(C)
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Sequential Labeling (Cont.)Sequential Labeling (Cont.)What if B & C are labeled but label(B) label(C) ?
3-D Computer Vision CSc 83020 – Ioannis Stamos3-D Computer Vision CSc 83020 – Ioannis Stamos
Sequential Labeling (Cont.)Sequential Labeling (Cont.)What if B & C are labeled but label(B) label(C) ?
2 2 22 2 2 2 2 2
22 2 2 2 2
2 2 2 22 2 2 22 2 2 2 22
1 1 11 1 1
1 1 1 1 1 11 1 11 1 1
1 1 1 1 1 1
11
11
11
1 11 11 11
?