image segmentation and morphological processing digital image processing in life- science aviad...
TRANSCRIPT
Image Segmentation and Morphological Processing
Digital Image Processing in Life- ScienceAviad Baram 4-4-2012
Image In Attributesout
Image In Image out
Processing vs Analysis
Image processing:
Image analysis:
EnhancecontrastSmooth
RegionEdges“meaning”
Part I - Segmentation
Subdivide the image into constituent regions or objects (sets)
Based on properties of intensity values
▪ Discontinuity – changes (e.g. edges)
▪ Similarity – partition into similar regions
∑i=1
n
Ri=R Q (Ri )≠Q (R j )
Basic set operations
Union (Rr∪Rg)Complementary (Rrgc)Intersect (Rr∩Rg)Exclusive or (Rr⊕Rg)
Synonyms in set operations
Selection
ROI
Make Inverse
OR (Combine)
AND
XOR
Mathematical
Set (Ri)
Complementary (Ric)
Union (Ri∪Rj)
Intersect (Ri∩Rj)
Exclusivedisjunction (Ri⊕Rj)
BinaryMask
Inverse
OR
AND
XOR
Automatic approaches
■ Discontinuity – Edge based methods■ Classical gradient detectors (Sobel, Prewitt...)■ Canny edge detector
■ Similarity - threshold
Why?Human comprehension is far superior UnbiasedHigh throughput – ImageJ macros
Edge detection
Find the boundary of a region by identifying points, lines and edges
Tools:
▪ Second derivatives (Laplacian) operators
▪ Very sensitive to noise
▪ Double line detection (show example)
▪ First derivative
▪ Smoother
▪ Less sensitive
Derivatives noise
First derivative Second derivative
Derivatives noise
First derivative Second derivative
Derivatives noise
First derivative
Second derivative
Laplacian double edge
Prewitt and Sobel
Derivative Sobel
-1
-2 0
1
210
0
-1
Laplacian of Gaussian - LoG
Laplacian LoG
Canny edge detector
angle
norm
Nonmaxima suppression along gradient
Double threshold → use TH edge pixelsas seeds to connect TL edges
Edge detection Summary
1st derivative 2nd derivative Source
LoGSobel Canny
Similarity - Threshold
Partition Image into regions
▪ Global threshold
▪ Adaptive threshold
▪ Smaller image blocks
▪ Threshold for each blocks
▪ Interpolate results for each pixels
Global threshold - noise
g ( x,y )={a iff ( x,y )>T 2b ifT1<f ( x,y )≤T 2
c iff ( x,y )≤T 1}
T1
T2
abc
Global threshold - background
Automatic global threshold
Example 1 - mean:
Initial estimatefor T
Segment into G1 and G2
Compute meanfor G1 and G2
Compute new thresholdT=
12 ( ⟨G1⟩+ ⟨G2⟩ )
G1 G2
⟨G1⟩ ⟨G2⟩
Repeat until no significant change
Automatic global thresholdExample 2 – Otsu: minimize error in pixelassignment to groups
Global mean: mG
Global variance: σ2G
mean1 mean2
Between-class variance: σ2B
η=σ B
2
σG2
“goodness” of TH:
Calculate for allthresholds and choosethe max σ2
B
smoothing imagesimproves auto segmentation
Local thresholding
Calculate T from “subimage” histogram (e.g. edges...) ⇒ apply to full image
Variable thresholding
For each pixel, f(x,y), compute a threshold, Txy, based on mxy and σxy of neighborhood Sxy
Meanm - mean σ - variance
T xy=aσ xy+bm xy
T xy=aσ xy+bmG
g ( x,y )={1 iff ( x,y )>T xy0 iff ( x,y )≤T xy }
Part II - Morphology
Processing of region shapes
Structuring Elements
Erosion
A B⊖
Erosion
Remove connecting linesShrink regions
Dilation
A B⊕
Dilation
Bridge gapsGrow regions
Dilate⇔ErodeC
Open
A◦B
Smooth contourBreak narrow bridgesEliminate protrusions
nX Erode → n X dilate
Close
A•B
Smooth contourFuse narrow breaksEliminate small holesFills gaps
nX dilate → n X erode
Open⇔CloseC
Boundary extraction
Subtract the eroded image from original
Skeletons
Minimal set required for reconstruction
ImageJ built in function – erode to single pixel
Fill holes
Hole – background region surrounded by a foreground connected border
Hit or Miss
A B=(A B⊛ ⊖1)∩(AC B⊖
2)
Shape detection
Probe for object
Probe for background
Watershed
ImageJ built inSegmentationGray level
ImageJ Set Measurement...
Gray level morphology
Erode DilateOpen Close
Examples
Yael Mutsafi Ayelet Tetelboim