Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
EECS490: Digital Image Processing
Lecture #19
• Shading and texture analysis using
morphology
• Gray scale reconstruction
• Basic image segmentation: edges v. regions
• Point and line locators, edge types and noise
• Edge operators: LoG, DoG, Canny
EECS490: Digital Image Processing
Gray Scale Morphology
© 2002 R. C. Gonzalez & R. E. Woods
original “top-hat”
h = f f b( )
A top-hat transformationsubtracts an opening fromthe image.
Enhances detail inthe presence ofshading
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Gray-Scale Morphology
EECS490: Digital Image Processing
Chapter 9Morphological Image Processing
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Gray-Scale Morphology
Algorithm for locatingtexture boundaries1. Repeatedly close theinput image with a SEsmaller than the largecircles. This willeventually remove allthe smaller objects.2. Now do a singleopening with a SElarger than theseparation betweenright hand circles3. Use a morphologicalgradient to computethe boundary
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Gray-Scale MorphologySmooth to eliminatewood grain
Open withr=10 disk
Open withr=20 disk
Open with r=25 disk
Open withr=30 disk
Summing the surface area (light intensity) and subtracting to determinethe change as a function of r gives the particle size distribution
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Gray-Scale Morphology
This shows that the image is basically composedof images of r=19 and r=27 particles
EECS490: Digital Image Processing
Gray Scale Morphology
© 2002 R. C. Gonzalez & R. E. Woods
Granulometry — how to determine size distributions1. Open with structuring elements which increase in size with eachiteration2. Compute differences between original and each opening3. Normalize these differences to give the size distribution
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Gray-Scale Morphology
Original image
Opening by reconstructionusing 71 pixel horizontal line
Opening using 71 pixelhorizontal line
Top-hat byreconstruction 71pixel horizontal line
Top-hat
Opening byreconstructionusing 11 pixelvertical line
Dilation byreconstructionusing 21 pixelvertical line
MINFinal reconstruction
Thisillustratesmorphologicalreconstruction to eliminatevertical andhorizontallines andshadows in animage.
EECS490: Digital Image Processing
Chap. 10 Image Segmentation
EECS490: Digital Image Processing
Image Segmentation
• Segmentation partitions image R intosubregions R1, R2, …, Rn such that:– R1 R2 … Rn=R
– Each Ri is a connected set– Ri Rj=0 for all i,j where i
– Q(Ri)=TRUE for every i
– Q(Ri Rj)=FALSE for any two adjacent regions
EECS490: Digital Image Processing
Image Segmentation
© 2002 R. C. Gonzalez & R. E. Woods
Original images
Boundariesobtained fromderivatives orsimilartechniques
Segmented image.Ri are orthogonaland havedifferentintensity.
Edge-basedsegmentation
Region-basedsegmentation
Segmented imagebased uponstandarddeviation of theintensity in 4x4regions
EECS490: Digital Image Processing
Line Detection
© 2002 R. C. Gonzalez & R. E. Woods
Edge basedsegmentationrequires findinggood edges —typically using afirst or secondderivative spatialoperator.
There are multiple typesof edges such as rampand step giving differentresponses.
First derivativeoperators typically givethicker edge responses;second derivativeoperators respond tofiner detail, includingnoise
Second derivatesproduce a double edgeresponse for ramp andstep edges
EECS490: Digital Image Processing
Line Detection
© 2002 R. C. Gonzalez & R. E. Woods
While we typically regarded a mask such as the 3x3 shown aboveas a spatial operator it can also be thought of as a correlationmask.
EECS490: Digital Image Processing
Line (and point) Detection
© 2002 R. C. Gonzalez & R. E. Woods
Single black pixelwe want to find
Regard thisas acorrelationmask for ablack pixel,i.e., a pointlocator
Response R tocorrelationmask
Threshold atT=90 of maxpixel intensity
R = wizii=1
9
EECS490: Digital Image Processing
Line Detection
© 2002 R. C. Gonzalez & R. E. Woods
Original image Laplacian processedimage. Intensitytransformed so 50%gray is zero. Double lineeffect is clearly visible.
Absolute value ofthe Laplacian giveswide lines
Using only positive valuesof the Laplacian givesnarrower lines.
EECS490: Digital Image Processing
Line Detection
© 2002 R. C. Gonzalez & R. E. Woods
These can be regarded as line detector masks for lines withspecific orientations.
EECS490: Digital Image Processing
Line Detection
© 2002 R. C. Gonzalez & R. E. Woods
Original image Response using +45˚line detector
Zoom of topleft response
Zoom of bottomright response
Response withall negativevalues set tozero
Select onlymaximum valuesfrom (e)
EECS490: Digital Image Processing
Line Detection
© 2002 R. C. Gonzalez & R. E. Woods
Step edge andits intensityprofile.
Ramp edge andits intensityprofile.
Roof edge andits intensityprofile.
EECS490: Digital Image Processing
Line Detection
© 2002 R. C. Gonzalez & R. E. Woods
Real intensity image showing multiple typesof edges
EECS490: Digital Image Processing
Line Detection
© 2002 R. C. Gonzalez & R. E. Woods
Observations:1. Magnitude of the firstderivative can be used to detectthe presence of an edge at apoint2. Sign of second derivativeindicates which side of the edgethe pixel is on3. Zero crossings of the secondderivative can be used to locatethe centers of thick edges
EECS490: Digital Image Processing
Line Detection
© 2002 R. C. Gonzalez & R. E. Woods
Ramp edgecorrupted bysteadilyincreasingamounts ofadditiveGaussian noise
Firstderivative
Secondderivative
Fundamental steps inedge detection:1. Smoothing — fornoise reduction2. Detection — of allpotential edgecandidates3. Localization — selectthe real edge points
EECS490: Digital Image Processing
Line Detection
© 2002 R. C. Gonzalez & R. E. Woods
Strength and direction of an edge can bedetermined using the gradient
f =
f
xf
y
=gxgy
Strength (magnitude)
Direction
M x, y( ) = mag f( ) = gx2+ gy
2
x, y( ) = Tan 1 gxgy
EECS490: Digital Image Processing
Line Detection
© 2002 R. C. Gonzalez & R. E. Woods
f =
f
xf
y
=1
1
Gray=0, white=1
The gradientvector isperpendicular tothe actual edge.
EECS490: Digital Image Processing
Image Segmentation
© 2002 R. C. Gonzalez & R. E. Woods
The Prewittand Sobel arethe mostcommonlyused gradientmasks
The Sobel has betternoise characteristicsthan the Prewitt
EECS490: Digital Image Processing
Image Segmentation
© 2002 R. C. Gonzalez & R. E. Woods
ModifiedPrewitt andSobel masks fordetectingdiagonal edges
-45˚ +45˚
EECS490: Digital Image Processing
Image Segmentation
© 2002 R. C. Gonzalez & R. E. Woods
1200x1600original image
|Gx| using 3x3Sobel
|Gy| using 3x3Sobel
|Gx|+|Gy|gradientapproximation
EECS490: Digital Image Processing
Image Segmentation
© 2002 R. C. Gonzalez & R. E. Woods
Gradient angle plotted as an intensity. Areas of constant intensity havethe same gradient vector (perpendicular to the edge). Black means thegradient vector is at 0˚ so the actual edge is vertical (at -90˚)
EECS490: Digital Image Processing
Image Segmentation
© 2002 R. C. Gonzalez & R. E. Woods
1200x1600original imagesmoothed with a5x5 averagingfilter
|Gx| using 3x3Sobel
|Gy| using 3x3Sobel
|Gx|+|Gy|gradientapproximation
Averagingcauses theedges to beweaker butcleaner. Noteloss of brickedges
EECS490: Digital Image Processing
Image Segmentation
© 2002 R. C. Gonzalez & R. E. Woods
-45˚ Sobel +45˚ Sobel
Note that both can detect a horizontal or verticaledge, but with a weaker response than ahorizontal or vertical operator
EECS490: Digital Image Processing
Image Segmentation
© 2002 R. C. Gonzalez & R. E. Woods
Thresholded gradientimage w/o smoothing
Thresholded gradientimage w/smoothing
Threshold = 1/3 max_value
EECS490: Digital Image Processing
Image Segmentation
© 2002 R. C. Gonzalez & R. E. Woods
The LoG is sometimescalled the Mexican hatoperator
The Laplacian isNEVER used directlybecause of its strongnoise sensitivity
Combining theLaplacian with aGaussian gives the LoG
2h r( ) =r2 2
4e
r2
2 2
EECS490: Digital Image Processing
Image Segmentation
Marr-Hildereth algorithm:– Filter image with a nxn Gaussian low-pass filter
– Compute the Laplacian of the filtered image using anappropriate mask
– Find the zero crossings of this image
This operator is based upon a 2nd derivative operator and canbe scaled using the parameter to fit a particular image orapplication, i.e., small operators for sharp detail and largeoperators for blurry edges
G x, y( ) = ex2 + y2
2 2