chapter 2. image analysis. image analysis domains frequency domain spatial domain
TRANSCRIPT
Chapter 2. Image AnalysisChapter 2. Image Analysis
Image Analysis DomainsImage Analysis Domains
Frequency Domain
Spatial Domain
Image AlgebraImage Algebra
• AdditionAddition Morphing Morphing
• SubtractionSubtraction Segmentation Segmentation
• Multiplication by constant Multiplication by constant brighter brighter
• Division by constantDivision by constant darker darker
• ANDAND mask mask
• OROR mask mask
• NOTNOT negative negative
ExampleExample
Image GeometryImage Geometry
• ScalingScaling
• TranslationTranslation
• RotationRotation
How to enlarge an imageHow to enlarge an image(Scaling or Sampling)(Scaling or Sampling)
• Zero-order hold (expand & duplicate)Zero-order hold (expand & duplicate)
• First-order hold (linear interpolation)First-order hold (linear interpolation)
Two methodsTwo methods1.1. Expand rows, then expand columnsExpand rows, then expand columns2.2. Extend with zeros, then perform Extend with zeros, then perform convolutionconvolution
process (support by hardware)process (support by hardware)
First Method (Method I)First Method (Method I)
828
484
848
85258
46864
86468
85258
65.555.56
46864
66666
86468
Convolution Convolution processprocess
],[],[],[,
jiMjyixIyxIji
Kernel or Mask
ConvolutioConvolutionn
First Order (method II)First Order (method II)
828
484
848
85258
65.555.56
46864
66666
86468
4
1
2
1
4
12
11
2
14
1
2
1
4
1
0000000
0802080
0000000
0408040
0000000
0804080
0000000
How to reduce # of gray levelsHow to reduce # of gray levels(Quantization)(Quantization)
• Converting the lower bits to 0 via an Converting the lower bits to 0 via an AND operation.AND operation.
• Converting the lower bits to 1 via an Converting the lower bits to 1 via an OR operation.OR operation.
• Improved gray-scale (IGS) Improved gray-scale (IGS) quantizationquantization remove remove false contourfalse contour
• Variable bin size quantizationVariable bin size quantization
Example of Example of IGSIGS
Example of IGSExample of IGS
IGS Quantization recognizes the eye’s inherent sensitivity to edges and breaks them up by adding to each pixel a random number, which is generated from the low-order (Least Significant Bits) of neighboring pixels.
Improved Gray-Scale (IGS) Improved Gray-Scale (IGS) Quantization Quantization
A sum is formed from the current 8-bit gray-level value and the four least significant bits of a previously generated sum. If the four most significant bits of the current value are 1111, however, 0000 is added instead.
An ExampleAn Example
IGS PracticeIGS Practice
Consider an 8-pixel line of gray-scale data, {12, 12, 13, 13, 10, 13, 57, 54}, which has been uniformly quantized with 6-bit
accuracy. Construct its 3-bit IGS (Improved Gray-Scale) code.
SmoothingSmoothing
Just like IntegrationJust like Integration
ji
jyixIyxI,
],[],[
Image FilteringImage Filtering
• Linear filterLinear filter
• Non-linear filterNon-linear filter
],[],[],[,
jiMjyixIyxIji
Image SmoothingImage Smoothing
• Mean Filtering
• Gaussian Filtering
• Median Filtering• Smoothing uniform regions• Preserve edge structure
Mean Filtering ExampleMean Filtering Example
GaussiaGaussian n Filtering Filtering MasksMasks
Properties of smoothing masksProperties of smoothing masks
• The amount of smoothing and noise reduction is proportional to the mask size.
• Step edges are blurred in proportion to the mask size.
Median Median Filtering Filtering ExamplExamplee
ExampleExample
Edge DetectionEdge Detection
Just like DifferentiationJust like Differentiation
12
12
xx
ff
dx
df
DetectinDetecting Edgesg Edges
Edge Detection MasksEdge Detection Masks
Properties of derivative Properties of derivative masksmasks
• The sum of coordinates of derivative masks is zero so that a zero response is obtained on constant regions.
• First derivative masks produce high absolute values at point of high contrast.
• Second derivative masks produce zero-crossings at points of high contrast.
Edge Magnitude & Edge Magnitude & OrientationOrientation
Laplacian Of Gaussian (LOG)Laplacian Of Gaussian (LOG)
Zero crossing detectionZero crossing detection
• A zero crossing at a pixel implies that the values of the two opposing neighboring pixels in some direction have different signs.
• There four cases to test:1. up/down2. left/right3. up-left/down-right4. up-right/down-left
),(),(),(),(),( 22 yxfyxgyxfyxgyxh
Two equivalent methodsTwo equivalent methods
1. Convolve the image with a Gaussian smoothing filter and compute the Laplacian of the result.
2. Convolve the image with the linear filter that is the Laplacian of the Gaussian filter.
1 2
Gaussian EquationsGaussian Equations
GaussiaGaussian Plotsn Plots
Gaussian PropertiesGaussian Properties
• Symmetry matrix
• 95% of the total weight is contained within 2 of the center.
• In the first derivative of 1D Gaussian, extreme points are located at – and + .
• In the second derivative of 1D Gaussian, zero crossings are located at – and + .
• The LOG filter responds well to:1. small blobs coinciding with the center lobe.2. large step edges very close to the center lobe.
LOG MasksLOG Masks
LOG ExampleLOG Example
Frei-Chen Edge DetectionFrei-Chen Edge Detection
• Represent any 3x3 subimage as a weighted Represent any 3x3 subimage as a weighted sum of the nine Frei-Chen masks.sum of the nine Frei-Chen masks.
• Weights are found by projecting a 3x3 Weights are found by projecting a 3x3 subimage onto each of these masks.subimage onto each of these masks.
• The projection is performed through The projection is performed through convolution.convolution.
Frei-Frei-Chen Chen MasksMasks
Projection of vectorsProjection of vectors
992211 )()()( fIffIffIfI ST
ST
ST
S
Since f1 , f2, … , f9 are nine 9D orthonormal vectors
Errors in Errors in Edge Edge DetectioDetectionn
Pratt Figure of Merit Rating Pratt Figure of Merit Rating FactorFactor
• IINN = maximum( = maximum(III I , , IIFF))
• IIII = # of ideal edge points = # of ideal edge points
• IIFF = # of found edge points = # of found edge points
• αα = a scaling constant to adjust the penalty for offset edges = a scaling constant to adjust the penalty for offset edges
• ddii = the distance of a found edge point to an ideal edge point = the distance of a found edge point to an ideal edge point
FI
i iN dIR
121
11
Noise RemovalNoise Removal
Pepper & Salt Noise Pepper & Salt Noise ReductionReduction
• Change a pixel from 0 to 1 if all neighborhood pixels of the pixel is 1
• Change a pixel from 1 to 0 if all neighborhood pixels of the pixel is 0
Expanding & ShrinkingExpanding & Shrinking
Example 1Example 1
Example Example 22
Image SegmentationImage Segmentation
• Region Based
• Clustering
• Region Growing
• Edge based
• Boundary Detection
Space of ClusteringSpace of Clustering
• Histogram spaceHistogram space Thresholding Thresholding
• Color spaceColor space K-Means K-Means ClusteringClustering
• Spatial spaceSpatial space Region Growing Region Growing
Histogram & ThresholdingHistogram & Thresholding
P-Tile ThresholdingP-Tile Thresholding
Mode ThresholdingMode Thresholding
Mode AlgorithmMode Algorithm
Iterative ThresholdingIterative Thresholding
Adaptive Adaptive ThresholdinThresholding Exampleg Example
Adaptive ThresholdingAdaptive Thresholding
Variable Variable ThresholdinThresholding Exampleg Example
Double Thresholding Double Thresholding MethodMethod
Double Double Thresholding Thresholding ExampleExample
RecursivRecursive e HistograHistogram m ClusterinClusteringg
ClusteringClustering
Iterative K-Means ClusteringIterative K-Means Clustering
Example of Region GrowingExample of Region Growing
Region GrowingRegion Growing(Split & Merge Algorithm)(Split & Merge Algorithm)
1. Split the image into equally sized regions.2. Calculate the gray level variance for each region3. If the gray level variance is larger than a threshold,
then split the region. Otherwise, an effort is made to merge the region with its neighbors.
4. Repeat Step 2 & 3.
Gray level variance :
2)),(()(
),(
IcrIIVar
N
crII
Boundary DetectionBoundary Detection
1. Canny Edge Detector
2. Hough Transform
Canney Canney Edge Edge
DetectDetectoror
Canny Canny Edge Edge DetectoDetector r ExamplExamplee
Hough TransformHough Transform
Accumulator array for Accumulator array for Hough TransformHough Transform
Hough Hough Transform Transform
for for AccumulatiAccumulating Straight ng Straight
LinesLines
Hough Hough TransforTransform m ExampleExample
Hough Hough Transform Transform for for Extracting Extracting Straight Straight LinesLines
Example of Example of Hough Hough TransformTransform
Morphological FilterMorphological Filter
MorphologicMorphological Filteral Filter
ExamplExamplee
Example Example
Closing & OpeningClosing & Opening
Opening ExampleOpening Example
Morphological Morphological Filter Example Filter Example 11
Structure Element Structure Element Example 1Example 1
MorphMorpho-o-logical logical Filter Filter ExamplExample 2e 2
Structure Element Example Structure Element Example 22
Conditional DilationConditional Dilation
Conditional Conditional Dilation Dilation ExampleExample
Image TransformImage Transform
)()()( 2211 kfskfskI
Basis VectorsBasis Vectors
Transform Transform CoefficientsCoefficients
Fourier TransformFourier Transform
1. Remove high frequency noise2. Extract texture features3. Image compression
Discrete Fourier TransformDiscrete Fourier Transform
N
evuFcrI
N
ecrIvuF
N
v
N
vcurjN
u
N
c
N
vcurjN
r
1
0
)(21
0
1
0
)(21
0
),(),(
),(),(
kk ekIekIkkIjkkIjba
kbkakbkaakI
)()(sin)(cos)(
2sin2cossincos)(
11
22110
Magnitude & Phase of Magnitude & Phase of Discrete Fourier Discrete Fourier TransformTransform
),(
),(tan),(
),(),(),(
1
22
vuR
vuIvuPhase
vuIvuRvuFMagnitude
Separability of Fourier Separability of Fourier TransformTransform
1
0
2
1
0
2
1
0
21
0
21
0
)(21
0
),(),(
),(),(
),(),(),(
N
c
N
vcj
N
r
N
urj
N
c
N
vcjN
r
N
urjN
c
N
vcurjN
r
ecrIvrF
N
evrFvuF
N
ecrIe
N
ecrIvuF
Properties of Fourier Properties of Fourier TransformTransform
),(),(
),(),(
),(1
),(
),(),(
),(),(
),(),(
00
)(2
00
00
Fdf
Fdf
b
v
a
uF
abbcarf
vuFcrf
evuFccrrf
vuFcrf
N
vcurj Translation
Brightness
Scaling
Rotation
Discrete Cosine TransformDiscrete Cosine Transform
0for 2
0for 1
)(),(
2
)12(cos
2
)12(cos),()()(),(
2
)12(cos
2
)12(cos),()()(),(
1
0
1
0
1
0
1
0
u,vN
u,vNvuwhere
N
cv
N
ruvuCvucrI
N
cv
N
rucrIvuvuF
N
v
N
u
N
c
N
r
Discrete Discrete Cosine Cosine TransformTransformBasis Basis ImagesImages
Walsh-Hadamard TransformWalsh-Hadamard Transform
N
vuWcrI
N
crIvuW
N
v
vpcbuprbN
u
N
c
vpcbuprbN
r
n
iiiii
n
iiiii
1
0
)()()()(1
0
1
0
)()()()(1
0
1
0
1
0
1),(),(
1),(),(
Walsh-Walsh-Hadamard Hadamard Basis Basis ImagesImages
Construction of Walsh-Hadamard Construction of Walsh-Hadamard Basis ImagesBasis Images
Frequency Domain Image Frequency Domain Image FilteringFiltering
Bandpass FilteringBandpass Filtering
Symmetry Symmetry of the of the Fourier Fourier TransformTransform
SymmetrSymmetry of the y of the Discrete Discrete Cosine Cosine TransforTransformm
Ideal Lowpass FilterIdeal Lowpass Filter
Nonideal Lowpass FilterNonideal Lowpass Filter
Highpass FilterHighpass Filter
Bandpass & Bandreject FilterBandpass & Bandreject Filter
Convolution TheoremConvolution Theorem
),(),()),(()),(()),(),(( vuHvuGyxhFyxgFyxhyxgF
1. Fourier transform the image g(x,y) to obtain its frequency representation G(u,v)
2. Fourier transform the mask h(x,y) to obtain its frequency representation H(u,v)
3. Multiply G(u,v) and H(u,v) pointwise
4. Apply the inverse Fourier transform to obtain the filtered image