Local Enhancement 1Local Enhancement• Local Enhancement•Median filtering (see notes/slides, 3.5.2)•HW4 due next Wednesday•Required Reading: Sections 3.3, 3.4, 3.5, 3.6, 3.7Local Enhancement 2Local enhancementSometimes LocalEnhancement isPreferred.Malab: BlkProcoperation for blockprocessing.Left: original “tire”image.Local Enhancement 3Histogram equalizedLocal Enhancement 4Local histogram equalizedF=@ histeq;I=imread(‘tire.tif’);J=blkproc(I,[20 20], F);Local Enhancement 5Fig 3.23: Another exampleLocal Enhancement 6Local Contrast Enhancement• Enhancing local contrast g (x,y) = A( x,y ) [ f (x,y) - m (x,y) ] + m (x,y)A (x,y) = k M / σ(x,y) 0 < k < 1M : Global meanm (x,y) , σ (x,y) : Local mean and standard dev.Areas with low contrast Larger gain A (x,y) (fig 3.24-3.26)Local Enhancement 7Fig 3.24Local Enhancement 8Fig 3.25Local Enhancement 9Fig 3.26Local Enhancement 10Image Subtractiong (x,y) = f (x,y) - h (x,y)h(x,y)—a low pass filtered version of f(x,y).• Application in medical imaging --“mask moderadiography”• H(x,y) is the mask, e.g., an X-ray image of part of abody; f(x,y) –incoming image after injecting acontrast medium.Local Enhancement 11Subtraction: an exampleLocal Enhancement 12Fig 3.28: mask mode radiographyLocal Enhancement 13AveragingFig 3.30 and Uncorrelated zero meanduces the noise variance2 22g x y f x y x yg x yMg x yE g x y f x yMx yx yx yiiMg( , ) ( , ) ( , )( , ) ( , )( ( , )) ( , ) ( , )( , )( , ) Re= +== =!!="#$ $#$##111Local Enhancement 14Fig 3.30Local Enhancement 15Another exampleImages with additiveGausian Noise;IndependentSamples.I=imnoise(J,’Gaussian’);Local Enhancement 16Averaged imageLeft: averaged image (10 samples); Right: original imageLocal Enhancement 17Spatial filteringFrequencySpatial 0LPFHPFBPFLocal Enhancement 18Smoothing (Low Pass) Filteringω1ω2ω3ω4ω5ω6ω7ω8ω9f1f2f3(x,y)Replace f (x,y) with Linear filterLPF: reduces additive noise blurs the image sharpness details are lost (Example: Local averaging)Fig 3.35f x y fiii^( , ) =!"Local Enhancement 19Fig 3.35: smoothingLocal Enhancement 20Fig 3.36: another exampleLocal Enhancement 21Image Dithering• Dithering: to produce visually pleasing signalsfrom heavily quantized data.– Halftoning: convert a gray scale image to a binaryimage by thresholding.– Dithering to “add” noise so that the resulting image issmoother than just thresholding (but still it is a binaryimage)– Your homework #4 explores this further with aMATLAB exercise.Local Enhancement 22Median filteringReplace f (x,y) with median [ f (x’ , y’) ](x’ , y’) E neighbourhood• Useful in eliminating intensity spikes. ( salt & pepper noise)• Better at preserving edges. Example:10 20 2020 15 2025 20 100( 10,15,20,20,20,20,20,25,100)Median=20 So replace (15) with (20)Local Enhancement 23Median Filter: Root SignalRepeated applications of median filter to a signal resultsin an invariant signal called the “root signal”.A root signal is invariant to further application of themedina filter.ExampleExample: 1-D signal: Median filter length = 30 0 0 1 2 1 2 1 2 1 0 0 00 0 0 1 1 2 1 2 1 1 0 0 00 0 0 1 1 1 2 1 1 1 0 0 00 0 0 1 1 1 1 1 1 1 0 0 0 root signalLocal Enhancement 24Invariant SignalsInvariant signals to a median filter:ConstantMonotonicallyincreasing decreasinglength?Local Enhancement 25Fig 3.37: Median Filtering exampleLocal Enhancement 26Media Filter: another exampleOriginal and with salt & pepper noiseimnoise(image, ‘salt & pepper’);Local Enhancement 27Donoised imagesLocal averagingK=filter2(fspecial(‘average’,3),image)/255.Median filteredL=medfil2(image, [3 3]);Local Enhancement 28Sharpening Filters• Enhance finer image details (such as edges)• Detect region /object boundaries.−1 −1 −1−1 8 −1−1 −1 −1Example:Local Enhancement 29Edges (Fig 3.38)Local Enhancement 30Unsharp MaskingSubtract Low pass filtered version from the originalemphasizes high frequency informationI’ = A ( Original) - Low passHP = O - LP A > 1I’ = ( A - 1 ) O + HPA = 1 => I’ = HPA > 1 => LF components added back.Local Enhancement 31Fig 3.43 –example of unsharp maskingLocal Enhancement 32Derivative Filters−1 −1 −1−1 ω −1−1 −1 −11/9Gradient!f ="f"x"f"y#$%&'(T!f ="f"x)*+,-.2+"f"y)*+,-.2#$%%&'((12Local Enhancement 33Edge DetectionGradient based methodsxx0xx0f(x)f’(x)xx0f “(x)f(x)d(.)/dx| . | Thresholdf’(x)|f’(x)|< >LocalmaxNoYesX0 is anedgeNot an edgeX0 not an edge!f ="f"x"f"y#$%&'(TLocal Enhancement 34Digital edge detectorsz1z3z4z5z6z7z8z9z2Robert’s operator1 00 -10 1-1 0prewitt| z5-z9 | | z6-z8 | -1 -1 -10 0 01 1 1 -1 0 1-1 0 1-1 0 1Sobel’s -1 -2 -10 0 01 2 1 -1 0 1-2 0 2-1 0 1!f " z5# z8( )2+ z5# z6( )2$%&'12!f " z5# z8+ z5# z6Local Enhancement 35Fig 3.45: Sobel edge detectorLocal Enhancement 36Laplacian based edge detectors 11 -4 11•Rotationally symmetric, linear operator•Check for the zero crossings to detect edges•Second derivatives => sensitive to noise.! = +22222ffxfy""""Local Enhancement 37Fig 3.40: an
View Full Document