Download presentation
Presentation is loading. Please wait.
1
Pixel-Based Processing
ECE 847: Digital Image Processing Stan Birchfield Clemson University
2
detect objects, classify fruit,
Challenge ? original image detect objects, classify fruit, find banana stem Steps: binarize / threshold clean up binary image find regions corresponding to foreground objects compute properties of regions classify regions based on properties S. Birchfield, Clemson Univ., ECE 847,
3
Outline Pixel-based image transformations (thresholding, …)
Removing noise from binary image (morphological operators) Labeling regions (floodfill, connected components) Computing distance in an image (chamfer distance, …) Region properties (area and boundary properties) S. Birchfield, Clemson Univ., ECE 847,
4
What is a digital image? 75 81 83 96 94 62 74 76 87 100 80 89 93 53 67 86 90 105 60 77 99 115 S. Birchfield, Clemson Univ., ECE 847,
5
Accessing pixels in an image
Timing Test (640 x 480 image, get/set each pixel using 2.8 GHz P4) C / C++ Method 1: 1D array val = p[ y * width + x]; Method 2: 2D array val = p[y][x]; Method 3: pointers val = *p++; 6.6 ms 5.6 ms 0.5 ms (even faster with SIMD operations) Matlab Method 1: 2D array val = im(y,x); Method 2: parallelize im = im + constant; 21.4 ms 2.5 ms S. Birchfield, Clemson Univ., ECE 847,
6
Outline Pixel-based image transformations (thresholding, …)
Removing noise from binary image (morphological operators) Labeling regions (floodfill, connected components) Computing distance in an image (chamfer distance, …) Region properties (area and boundary properties) S. Birchfield, Clemson Univ., ECE 847,
7
Types of image transformations
Graylevel transforms I’(x,y) f( I(x,y) ) (arithmetic, logical, thresholding, histogram equalization, …) Geometric transforms I’(x,y) f( I(x’,y’) ) (flip, flop, rotate, scale, …) Area-based transforms I’(x,y) f( I(x,y), I(x+1,y+1), … ) (morphological operators, convolution) Global transforms I’(x,y) f( I(x’,y’), x’,y’ ) (Fourier transform, wavelet transform) A S. Birchfield, Clemson Univ., ECE 847,
8
identity inverse contrast threshold enhancement
Graylevel transforms identity inverse contrast threshold enhancement S. Birchfield, Clemson Univ., ECE 847,
9
Geometric transforms S. Birchfield, Clemson Univ., ECE 847,
10
Histograms image histogram Throws away all spatial information!
S. Birchfield, Clemson Univ., ECE 847,
11
Histogram equalization
S. Birchfield, Clemson Univ., ECE 847,
12
Running sum Example: [ 6 3 9 7 4 2] [6 9 18 25 29 31]
Step 1: Initialize 1D array int hist[256] ... Step 2: Compute running sum sum[0] = 0 for g = 1 to 255, sum[g] = sum[g-1] + hist[g] Example: [ ] [ ] S. Birchfield, Clemson Univ., ECE 847,
13
Histogram equalization
pdf Steps: Compute normalized histogram (PDF) int hist[256] = 0…0 float norm[256] for x, hist[ I(x) ]++ for g = 0 to 255, norm[g] = hist[g] / npixels Compute cumulative histogram (CDF) cum[0] = norm[0] for g = 1 to 255, cum[g] = cum[g-1] + norm[g] Transform for x, I(x) = 255*cum[ I(x) ] equal area cdf equal spacing new gray level running sum old gray level S. Birchfield, Clemson Univ., ECE 847,
14
Histogram equalization *
PDF p desired PDF p’ equal area equal area a a’ a’+d new gray level k’ CDF By definition, d { q d { a’ equal spacing new gray level k’ old gray level k where p is the PDF and q is the CDF S. Birchfield, Clemson Univ., ECE 847,
15
Histogram equalization *
p desired PDF PDF equal area p’ 1/(L-1) a b L-1 a’ a’+d L-1 old gray level k new gray level k’ scaled CDF L-1 q·(L-1) d { a’ new gray level k’ L-1 old gray level k S. Birchfield, Clemson Univ., ECE 847,
16
Histogram equalization *
p desired PDF PDF equal area p’ 1/(L-1) a1 b1 a2 b2 a1’ a1’+d a2’ a2’+d L-1 L-1 new gray level k’ scaled CDF d { L-1 a2’ q·(L-1) d { a1’ new gray level k’ L-1 old gray level k S. Birchfield, Clemson Univ., ECE 847,
17
Integral image Integral image is a 2D running sum S(x,y) = SS I(x,y)
To compute, S(x,y) = I(x,y) S(x-1,y-1) + S(x-1,y) + S(x,y-1) To use, V(l,t,r,b) = S(l,t) + S(r,b) - S(l,b) - S(r,t) Returns sum of values inside rectangle Note: Sum of values in any rectangle can be computed in constant time! S. Birchfield, Clemson Univ., ECE 847,
18
Thresholding Valley separates light from dark How to find it?
S. Birchfield, Clemson Univ., ECE 847,
19
A simple thresholding algorithm
Repeat until convergence: T ½ (m1 + m2) T. Ridler and S. Calvard, Picture Thresholding Using an Iterative Selection Method, IEEE Transactions on Systems, Man and Cybernetics, 8(8): , August 1978. S. Birchfield, Clemson Univ., ECE 847,
20
Ridler-Calvard algorithm
S. Birchfield, Clemson Univ., ECE 847,
21
percentage of pixels in first group variance of pixels in first group
Otsu’s method Threshold t splits image into two groups Calculate within-group variance of each group Search over all t to minimize total within-group variance; moment calculations make search efficient percentage of pixels in first group variance of pixels in first group S. Birchfield, Clemson Univ., ECE 847,
22
Otsu’s method S. Birchfield, Clemson Univ., ECE 847,
23
Local Entropy Thresholding (LET) *
Compute co-occurrence matrix Threshold s divides matrix into four quadrants Pick s that maximizes HBB(s)+HFF(s) Uses spatial information S. Birchfield, Clemson Univ., ECE 847,
24
Otsu vs. LET * image histogram Otsu LET
S. Birchfield, Clemson Univ., ECE 847,
25
Adaptive thresholding
background image histogram from Gonzalez and Woods, p. 597 S. Birchfield, Clemson Univ., ECE 847,
26
Double thresholding (hysteresis)
graylevel threshold too high: misses part of object object 1 object 2 threshold too low: captures noise noise pixel Algorithm: Threshold with high value Threshold with low value, retaining only the pixels that are contiguous with existing ones S. Birchfield, Clemson Univ., ECE 847,
27
Double thresholding example
1. Use high threshold to get seed pixel low threshold high threshold 3. Repeat 2. Floodfill using seed pixel S. Birchfield, Clemson Univ., ECE 847,
28
Double thresholding example
image low threshold retains some background combined using floodfill on low threshold with seeds from high threshold high threshold removes some foreground S. Birchfield, Clemson Univ., ECE 847,
29
We will explain Floodfill later
Double thresholding We will explain Floodfill later S. Birchfield, Clemson Univ., ECE 847,
30
Outline Pixel-based image transformations (thresholding, …)
Removing noise from binary image (morphological operators) Labeling regions (floodfill, connected components) Computing distance in an image (chamfer distance, …) Region properties (area and boundary properties) S. Birchfield, Clemson Univ., ECE 847,
31
Binary image as a set = S. Birchfield, Clemson Univ., ECE 847,
32
Set operations Fundamental operators Other operators DeMorgan’s Laws
S. Birchfield, Clemson Univ., ECE 847,
33
Minkowski operators Minkowski addition: Minkowski subtraction:
S. Birchfield, Clemson Univ., ECE 847,
34
Add each element of B to each element of A1
Minkowski addition Add each element of B to each element of A1 S. Birchfield, Clemson Univ., ECE 847,
35
Minkowski subtraction
Intersection of translating A2 to every point in B Two examples: S. Birchfield, Clemson Univ., ECE 847,
36
Minkowski addition: “Center-out” approach
(“center-out” is more intuitive) S. Birchfield, Clemson Univ., ECE 847,
37
Minkowski subtraction: “Center-out” approach
(“center-out” is more intuitive) S. Birchfield, Clemson Univ., ECE 847,
38
Morphological operations
morphology – study of form or shape Mathematical morphology – grew out of research at Fontainebleau in 1964 We will deal only with binary images Two fundamental operations: Dilation and Erosion (same as Mink. add.) (same as Mink. sub. after reflection) B is the structuring element (SE) S. Birchfield, Clemson Univ., ECE 847,
39
Dilation Algorithm (center-out): Looks like nonlinear convolution
Flip B horizontally and vertically (but often B is symmetric, so nothing is changed) Move B around Anywhere they intersect, turn center pixel on Looks like nonlinear convolution S. Birchfield, Clemson Univ., ECE 847,
40
Erosion Algorithm (center-out): Duality b/w dilation and erosion:
Move B around If there is not complete overlap, turn center pixel off Duality b/w dilation and erosion: S. Birchfield, Clemson Univ., ECE 847,
41
Common structuring elements
Usually SE is either B or B8 Greatly simplifies algorithm (and erosion is same as Min. sub.) S. Birchfield, Clemson Univ., ECE 847,
42
Dilation example Let B be 3x3 with all 1s. for y B A for x
if ( in(x-1, y) || in(x-1, y-1) || in(x-1, y+1) || in(x+1, y+1) ) out(x, y) = 1 else out(x, y) = 0 B A S. Birchfield, Clemson Univ., ECE 847,
43
Erosion example Let B be 3x3 with all 1s. for y B A for x
if ( in(x-1, y) && in(x-1, y-1) && in(x-1, y+1) && in(x+1, y+1) ) out(x, y) = 1 else out(x, y) = 0 B A S. Birchfield, Clemson Univ., ECE 847,
44
Why does dilation require flipping the structuring element?
Simple example: A B Without flipping With flipping Result is flipped! Fixed! S. Birchfield, Clemson Univ., ECE 847,
45
Closing and Opening Dilation fills gaps. Erosion removes noise
Combine them: First dilate, then erode (closing) First erode, then dilate (opening) Closing/opening retain object size Repeated applications do nothing Duality between closing and opening S. Birchfield, Clemson Univ., ECE 847,
46
Closing: dilate, then erode Opening: erode, then dilate
Closing and Opening Closing: dilate, then erode Opening: erode, then dilate S. Birchfield, Clemson Univ., ECE 847,
47
Morphology Example thresholded difference open then close erode dilate
S. Birchfield, Clemson Univ., ECE 847,
48
Accessing out-of-bounds pixels
If kernel is near boundary of image, some pixels of kernel will be out of bounds (OOB) What to do? Do not use OOB pixels (change kernel size near boundary) Do not compute output for pixels near boundary Extend image function: zero pad – OOB pixels have value of zero replicate – OOB pixels have value of closest pixel reflect – pixel values are extended by mirror reflection at border wrap – pixel values are extended by repeating extrapolate – pixel values are extended by extrapolating function near boundary No solution is best Problem also occurs with convolution S. Birchfield, Clemson Univ., ECE 847,
49
Outline Pixel-based image transformations (thresholding, …)
Removing noise from binary image (morphological operators) Labeling regions (floodfill, connected components) Computing distance in an image (chamfer distance, …) Region properties (area and boundary properties) S. Birchfield, Clemson Univ., ECE 847,
50
Binary images Each pixel is ON or OFF
We will say that foreground pixels are ON, background pixels are OFF In computer, each pixel has value of 0 or 1. We adopt convention that 0=OFF, 1=ON. Usually 0=black and 1=white, but sometimes display is reversed S. Birchfield, Clemson Univ., ECE 847,
51
Neighbors 4-neighbors N4 8-neighbors N8 diagonal neighbors ND
S. Birchfield, Clemson Univ., ECE 847,
52
Adjacency 4-adjacency: 8-adjacency: m-adjacency: or and Example: m 8 4
q p q or and Example: m 8 4 S. Birchfield, Clemson Univ., ECE 847,
53
Adjacency Use different connectedness for foreground and background to avoid inconsistency foreground: D8 background: D4 dumbbell S. Birchfield, Clemson Univ., ECE 847,
54
Connectivity, Regions and Boundaries
path from p to q is sequence of adjacent pixels p and q are connected in subset S if path exists between them containing only pixels in S connected component of p is set of pixels in S that are connected to p S is a region if it is a connected set boundary of S is the set of pixel in S that have one or more neighbors not in S S. Birchfield, Clemson Univ., ECE 847,
55
Boundary definitions binary image outer region boundary outer hole
complete boundary inner region boundary inner hole boundary inner complete boundary S. Birchfield, Clemson Univ., ECE 847,
56
Floodfill Fill a region with a new color Start with a seed point
All pixels are colored if they have the same color as the seed and are connected to the seed via pixels that have the same color as the seed seed pixel S. Birchfield, Clemson Univ., ECE 847,
57
Floodfill * Repeated applications of dilation can fill a region
image A structuring element B complement Ac ... but terribly inefficient S. Birchfield, Clemson Univ., ECE 847,
58
Floodfill Efficient implementation uses a stack called the frontier.
Function image = Floodfill(seed_point, image, new_color) old_color = image(seed_point) if (old_color == new_color) return frontier.Push(seed_point) image(seed_point) = newcolor while (NOT frontier.IsEmpty()) q = frontier.Pop(); for each neighbor r of q, if image(r) == old_color, frontier.Push(r) image(r) = new_color return image frontier: S. Birchfield, Clemson Univ., ECE 847,
59
Floodfill S. Birchfield, Clemson Univ., ECE 847,
60
Floodfill This code performs the same logic,
but does not change the pixels of the input image S. Birchfield, Clemson Univ., ECE 847,
61
Revisit: Double thresholding
S. Birchfield, Clemson Univ., ECE 847,
62
Connected components Recall that connected component of p is set of pixels in S that are connected to p Can solve the problem by repeated applications of Floodfill – assigning a new label to each new region Slightly more efficient implementation involves two passes through the image (union-find) S. Birchfield, Clemson Univ., ECE 847,
63
Connected components using floodfill
S. Birchfield, Clemson Univ., ECE 847,
64
Classical union-find connected component labeling algorithm
scan left-to-right, top-to-bottom U L P I(P) == I(U) ? 4-neighbor algorithm: YES NO C(P)=C(U) and set Equiv(U,L) C(P)=C(L) C(P)=C(U) C(P)=n++ I(P) == I(L) ? 4-neighbor mask: 8-neighbor mask: S. Birchfield, Clemson Univ., ECE 847,
65
Classical connected components: first pass
1 1 1 1 1 2 2 2 2 3 3 3 2 4 3 5 5 2 4 image components 1 2 3 4 5 equivalence table S. Birchfield, Clemson Univ., ECE 847,
66
Classical connected components: traverse table
1 1 1 1 1 2 2 2 2 3 3 3 2 4 3 5 5 2 4 image components 1 2 3 4 5 equivalence table S. Birchfield, Clemson Univ., ECE 847,
67
Classical connected components: second pass
1 1 1 1 1 3 3 3 4 3 4 image components 1 2 3 4 5 equivalence table S. Birchfield, Clemson Univ., ECE 847,
68
Another example from
69
Connected components Function labels = ConnectedComponents(image)
// first pass for y=0 to height-1, for x=0 to width-1, pix = image(x,y) if pix == image(x-1,y) && pix == image(x,y-1) labels(x,y) = labels(x,y-1) SetEquivalence(labels(x-1,y), labels(x,y-1)) else if pix == image(x-1,y) labels(x,y) = labels(x-1,y) else if pix == image(x,y-1) else labels(x,y) = next_label++ // second pass labels(x,y) = GetEquivalentLabel( labels(x,y) ) S. Birchfield, Clemson Univ., ECE 847,
70
Connected components Function SetEquivalence(a, b)
aa = GetEquivalentLabel(a) bb = GetEquivalentLabel(b) if aa > bb equiv[aa] = bb else if aa < bb equiv[bb] = aa Function b = GetEquivalentLabel(a) if a == equiv[a] return a else equiv[a] = GetEquivalentLabel(equiv[a]) return equiv[a] S. Birchfield, Clemson Univ., ECE 847,
71
S. Birchfield, Clemson Univ. , ECE 847, http://www. ces. clemson
72
Connected components quantized image components
S. Birchfield, Clemson Univ., ECE 847,
73
Outline Pixel-based image transformations (thresholding, …)
Removing noise from binary image (morphological operators) Labeling regions (floodfill, connected components) Computing distance in an image (chamfer distance, …) Region properties (area and boundary properties) S. Birchfield, Clemson Univ., ECE 847,
74
Perimeter Perimeter of binary region:
Dilate, then subtract Erode, then subtract (Which is better?) This only gives the pixels as binary image To get ordered list of contiguous pixels, use Wall Follow algorithm S. Birchfield, Clemson Univ., ECE 847,
75
Wall following Algorithm: Start at ON pixel
Move in any direction until end of region reached Turn right Repeat: If pixel to the left is ON, Turn left and move forward Else if pixel in front is OFF, Else move forward - This traverses clockwise, using 4-connectedness (other versions are possible) - Can be used to compute perimeter S. Birchfield, Clemson Univ., ECE 847,
76
Distance functions D is a distance function (metric) if
Common distance functions: shape of each? S. Birchfield, Clemson Univ., ECE 847,
77
Other distances Mahalanobis (weight differently along each axis)
Hausdorff (distance b/w point sets) A and B are subsets of S S. Birchfield, Clemson Univ., ECE 847,
78
Length along path Freeman formula c = 0 (overestimates)
# of isothetic moves # of diagonal moves Freeman formula c = 0 (overestimates) Pythagorean theorem c = 1 (underestimates) Kimura’s method c = ½ (good compromise) 3 methods compared: Freeman: L = 16.5 No=8 Pythagorean: L = 15.2 Example: Kimura: L = 15.7 Nd=6 circle with radius = 10 * isothetic (blue) * diagonal (orange) True arc length: L = 10*p/2 = 15.7 Nd=6 S. Birchfield, Clemson Univ., ECE 847,
79
Chamfering How to approximate “correct” distance (Euclidean)?
Along a path, Let m be number of isothetic moves (horizontal or vertical) Let n be number of diagonal moves Define chamfer distance between p and q as dab = min {am+bn} over all possible paths Chamfer distance is metric if a, b > 0 If b > 2a, then diagonal moves are ignored Special cases: a=1, b=infinity (Manhattan) a=1, b=1 (chessboard) a=1, b=sqrt(2) (another reasonable choice) a=1, b=1.351 (best approximation to Euclidean) a=3, b=4 (best integer approximation, scaled by factor of 3) [G. Borgefors, Distance transformations in digital images, CVGIP, 1986] S. Birchfield, Clemson Univ., ECE 847,
80
Chamfering (cont.) Chamfering is process of computing distance to each foreground pixel Two-pass algorithm Traverse top-to-bottom, left-to-right Traverse bottom-to-top, right-to-left In each case, compute minimum distance foreground pixels L: R: L: R: 4-connectivity 8-connectivity S. Birchfield, Clemson Univ., ECE 847,
81
“? :” means “if-else” (C conditional expression operator)
Chamfering (cont.) Algorithm (for D4 using Manhattan distance): Function labels = Chamfer(image) // first pass for y=0 to height-1, for x=0 to width-1, d(x,y) = image(x,y) ? : min(infinity, 1+d(x-1,y), 1+d(x,y-1)) // second pass for y=height-1 to 0 step -1, for x=width-1 to 0 step -1, d(x,y) = image(x,y) ? : min(d(x,y), 1+d(x+1,y), 1+d(x,y+1)) Note: “? :” means “if-else” (C conditional expression operator) S. Birchfield, Clemson Univ., ECE 847,
82
Uses of chamfering Find center of biggest part of shape (need to compute signed distance) Shape matching Useful for watershed thresholding (we will see this later) centroid largest chamfer value S. Birchfield, Clemson Univ., ECE 847,
83
Outline Pixel-based image transformations (thresholding, …)
Removing noise from binary image (morphological operators) Labeling regions (floodfill, connected components) Computing distance in an image (chamfer distance, …) Region properties (area and boundary properties) S. Birchfield, Clemson Univ., ECE 847,
84
} Descriptors We will focus on regions Region Boundary Euler number
convex hull skeleton moments compactness eccentricity (elongatedness) Boundary chain code signature r-q plot s-y plot boundary segments shape number Fourier descriptors We will focus on regions S. Birchfield, Clemson Univ., ECE 847,
85
Euler number E = C- H 1-1=0 1-2=-1 1-0=1 2-0=2 Measure of topology
components holes 1-1=0 1-2=-1 1-0=1 2-0=2 Measure of topology S. Birchfield, Clemson Univ., ECE 847,
86
Euler number Euler number computed as (N1-N2-2N3)4, where
N1 is the number of 2x2 patterns with 1 in either corner, 0 elsewhere (4 possible patterns) N2 is the number of 2x2 patterns with 0 in either corner , 0 elsewhere (4 possible patterns) N3 is the number of 2x2 checkerboard patterns (2 possible patterns) Explained in W.K. Pratt, Digital Image Processing, 1991 S. Birchfield, Clemson Univ., ECE 847,
87
Convex hull Convex – any line connecting two points in R is also in R
Convex hull – the minimal convex set containing R convex not convex S. Birchfield, Clemson Univ., ECE 847,
88
should skeleton touch boundary?
Skeletons should skeleton touch boundary? Point on skeleton is equidistant to >= 2 boundary points (without crossing) Or, equivalently, where wavefronts (grassfires) meet (shock graph) centers of maximal balls Blum’s Medial Axis Transform (MAT) Skeleton is highly sensitive to noise S. Birchfield, Clemson Univ., ECE 847,
89
Skeleton examples S. Birchfield, Clemson Univ., ECE 847,
90
Skeletonization by thinning
First compute MAT Then delete points such that do not remove endpoints do not break connectivity do not excessively erode region S. Birchfield, Clemson Univ., ECE 847,
91
Moments in 1D The pth moment of a function f: The pth central moment:
What are ? centroid (area, 0, variance, skew, kurtosis) m2 is also moment of inertia about axis passing through centroid S. Birchfield, Clemson Univ., ECE 847,
92
Moments in 2D The pqth moment of a 2D region: The pqth central moment:
can be grayscale or binary (more typical) (area) (variance in x) (variance in y) S. Birchfield, Clemson Univ., ECE 847,
93
Moments in 2D (cont.) The pqth normalized central moment:
Hu moments (derived from these) are invariant to translation rotation scaling skew (at least one of them is) S. Birchfield, Clemson Univ., ECE 847,
94
Moments example Simple 5x5 binary image: m00 = m10 = m01 = m11 = m20 =
12.0 23.0 21.0 37.0 65.0 63.0 m00 = m10 = m01 = m11 = m20 = m02 = 12.0 0.0 -3.3 20.9 26.3 S. Birchfield, Clemson Univ., ECE 847,
95
(and normalized / Hu) are computed without touching the pixels again!
Computing moments One pass through image to compute regular moments Central moments (and normalized / Hu) are computed without touching the pixels again! (Typically, f is a binarized image containing a single non-zero region) S. Birchfield, Clemson Univ., ECE 847,
96
Projections Project image onto x, y, or diagonal
Projection offers compact representation of image First-order moments of image are equal to first-order moments of projection Second-order moments require diagonal projection S. Birchfield, Clemson Univ., ECE 847,
97
Compactness Define compactness as
Related to eccentricity (elongatedness) Define compactness as (area = # of pixels, perimeter = length along boundary) compactness = 1 compactness < 1 (Note: discretization effects of computing perimeter are severe) Alternative: Use S. Birchfield, Clemson Univ., ECE 847,
98
Eccentricity Approximate region with ellipse eccentricity = a / a =
Formula given by PCA S. Birchfield, Clemson Univ., ECE 847,
99
Principal components analysis (PCA)
Given n points in d dimensional space Goals: fit ellipsoid to data reduce dimensionality Ellipsoid specified by center (given by mean of data) orientation of axes (given by eigenvectors of covariance matrix of data) length of axes (given by square root of eigenvalues of covariance matrix of data) S. Birchfield, Clemson Univ., ECE 847,
100
PCA (cont.) n points in d dimensional space mean covariance
eigenvalues and eigenvectors matrix form factorize covariance matrix S. Birchfield, Clemson Univ., ECE 847,
101
PCA (cont.) reconstruct x linear transformation
but elements of y are decreasingly important project to k-dimensional space linear transformation data uncorrelated! vectors ei form an orthonormal basis for space S. Birchfield, Clemson Univ., ECE 847,
102
PCA (cont.) S. Birchfield, Clemson Univ., ECE 847,
103
PCA example Simple 5x5 binary image: m = C = C = PLPT = major axis =
minor axis = (2.0, 2.0) (1/9) * [ ] [-10 12] [ ] [ ] [ ] [ ] [ ] [ ] e1√l1 = [ ]T e2√l2 = [ ]T e1 e2 l1 l2 S. Birchfield, Clemson Univ., ECE 847,
104
Best fitting ellipse The elliptical binary region in image
bounded by the ellipse has the following second-order moments To be an ellipse, (which is always true for a covariance matrix) Note: S. Birchfield, Clemson Univ., ECE 847,
105
Eccentricity and Direction
Covariance matrix of region Eigenvalues solve det(C-lI)=0) Eccentricity ranges from 0 (circle) to 1 (line) Direction Eigenvectors Hint: Use atan2(y,x), passing numerator and denominator as separate arguments (clockwise angle from positive x-axis) S. Birchfield, Clemson Univ., ECE 847,
106
} Eigenfaces mean face eigenvectors
N x N image is a point in an N2 dimensional space N2 x N2 Covariance matrix captures relationships between face images in ensemble Turk and Pentland, 1991 S. Birchfield, Clemson Univ., ECE 847,
107
Fruit classification (high threshold) original image (low threshold)
Note: double threshold and connected components can be computed simultaneously: scan high threshold image if pixel is 1, then floodfill using low threshold image (connected components) (double threshold) mij mij (moments) (classification) (banana stem) S. Birchfield, Clemson Univ., ECE 847,
108
Sample results fruit1.pgm fruit2.pgm
S. Birchfield, Clemson Univ., ECE 847,
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.