资源预览内容
第1页 / 共76页
第2页 / 共76页
第3页 / 共76页
第4页 / 共76页
第5页 / 共76页
第6页 / 共76页
第7页 / 共76页
第8页 / 共76页
第9页 / 共76页
第10页 / 共76页
亲,该文档总共76页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
Digital Image ProcessingDigital Image ProcessingChapter 3: Chapter 3: Image Enhancement in the Image Enhancement in the Spatial DomainSpatial Domain15 June 200715 June 2007Spatial Domain Spatial Domain What is spatial domain The space where all pixels form an image In spatial domain we can represent an image by f(x,y)where x and y are coordinates along x and y axis with respect to an origin There is duality between Spatial and Frequency DomainsImages in the spatial domain are pictures in the xy planewhere the word “distance” is meaningful.Using the Fourier transform, the word “distance” is lost but the word “frequency” becomes alive.Image EnhancementImage EnhancementImage Enhancement means improvement of images to be suitable for specific applications. Example: Note: each image enhancement technique that is suitable for one application may not be suitable for other applications.(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Image Enhancement ExampleImage Enhancement ExampleOriginal imageEnhanced image using Gamma correction(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.= Image enhancement using processes performed in the Spatial domain resulting in images in the Spatial domain.We can written asImage Enhancement in the Spatial DomainImage Enhancement in the Spatial Domainwhere f(x,y) is an original image, g(x,y) is an output and T is a function defined in the area around (x,y)Note: T may have one input as a pixel value at (x,y) only ormultiple inputs as pixels in neighbors of (x,y) depending in each function. Ex. Contrast enhancement uses a pixel value at (x,y) only for an input while smoothing filte use several pixels around (x,y) as inputs.Types of Image Enhancement in the Spatial DomainTypes of Image Enhancement in the Spatial Domain- Single pixel methods- Gray level transformations Example- Historgram equalization- Contrast stretching- Arithmetic/logic operations Examples- Image subtraction- Image averaging- Multiple pixel methodsExamplesSpatial filtering - Smoothing filters- Sharpening filtersGray Level TransformationGray Level TransformationTransforms intensity of an original image into intensity of an output image using a function:where r = input intensity and s = output intensityExample: Contrast enhancement(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Image NegativeImage NegativeWhiteBlackInput intensityOutput intensityOriginaldigitalmammogramL = the number of gray levels 0L-1L-1Negativedigitalmammogram(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.BlackWhiteLog TransformationsLog TransformationsFourierspectrumLog Tr. ofFourierspectrumApplication(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Power-Law TransformationsPower-Law Transformations(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Power-Law Transformations : Power-Law Transformations : Gamma Correction ApplicationGamma Correction ApplicationDesired imageImage displayed atMonitorAfterGammacorrection(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Image displayed atMonitorPower-Law Transformations : Power-Law Transformations : Gamma Correction ApplicationGamma Correction ApplicationMRI Image after Gamma Correction(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Power-Law Transformations : Power-Law Transformations : Gamma Correction ApplicationGamma Correction ApplicationAriel imagesafter GammaCorrection(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Contrast StretchingContrast StretchingBefore contrast enhancementAfter Contrast means the difference between the brightest and darkest intensities(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.How to know where the contrast is enhanced ? How to know where the contrast is enhanced ? Notice the slope of T(r)- if Slope 1 Contrast increases- if Slope 1 Contrast decrease- if Slope = 1 no changeDrDsSmaller Dr yields wider Ds= increasing Contrast (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Gray Level SlicingGray Level Slicing(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Bit-plane SlicingBit-plane SlicingBit 7Bit 6Bit 2Bit 1Bit 5Bit 3(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.HistogramHistogramHistogram = Graph of population frequencies Grades of the course 178 xxxHistogram of an ImageHistogram of an Image pixel pixel= graph of no. of pixels vs intensities(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Bright image has histogram on the rightDark image has histogram on the leftHistogram of an Image (cont.)Histogram of an Image (cont.)low contrast image has narrow histogram(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.high contrast image has wide histogramHistogram ProcessingHistogram Processing = intensity transformation based on histogram information to yield desired histogram - Histogram equalization - Histogram matchingTo make histogram distributed uniformlyTo make histogram as the desireMonotonically Increasing FunctionMonotonically Increasing Function= Function that is only increasing or constantProperties of Histogram processing function1. Monotonically increasing function2. Probability Density FunctionProbability Density Functionand relation between s and r isHistogram is analogous to Probability Density Function (PDF) which represent density of populationLet s and r be Random variables with PDF ps(s) and pr(r ) respectivelyWe getHistogram EqualizationHistogram EqualizationLetWe get!Histogram EqualizationHistogram EqualizationFormula in the previous slide is for a continuous PDFFor Histogram of Digital Image, we usenj = the number of pixels with intensity = jN = the number of total pixelsHistogram Equalization ExampleHistogram Equalization ExampleIntensity# pixels0201522531041555610710Total100Accumulative Sum of Pr20/100 = 0.2(20+5)/100 = 0.25(20+5+25)/100 = 0.5(20+5+25+10)/100 = 0.6(20+5+25+10+15)/100 = 0.75(20+5+25+10+15+5)/100 = 0.8(20+5+25+10+15+5+10)/100 = 0.9(20+5+25+10+15+5+10+10)/100 = 1.01.0Histogram Equalization Example (cont.)Histogram Equalization Example (cont.)Intensity (r)No. of Pixels(nj)Acc Sum of PrOutput valueQuantized Output (s)0200.20.2x7 = 1.41150.250.25*7 = 1.7522250.50.5*7 = 3.533100.60.6*7 = 4.244150.750.75*7 = 5.255550.80.8*7 = 5.666100.90.9*7 = 6.367101.01.0x7 = 77Total100Histogram EqualizationHistogram Equalization(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Histogram Equalization (cont.)Histogram Equalization (cont.)(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Histogram Equalization (cont.)Histogram Equalization (cont.)(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Histogram Equalization (cont.)Histogram Equalization (cont.)(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Histogram Equalization (cont.)Histogram Equalization (cont.)OriginalimageAfter histogram equalization, the imagebecome a low contrast image(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Histogram MatchingHistogram Matching : Algorithm: AlgorithmConcept : from Histogram equalization, we haveWe get ps(s) = 1We want an output image to have PDF pz(z)Apply histogram equalization to pz(z), we getWe get pv(v) = 1Since ps(s) = pv(v) = 1 therefore s and v are equivalentTherefore, we can transform r to z by rT( )sG-1( )zTo transform image histogram to be a desired histogramHistogram Matching : Algorithm (cont.)Histogram Matching : Algorithm (cont.)s = T(r)v = G(z)z = G-1(v)1234(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Histogram Matching ExampleHistogram Matching ExampleIntensity( s )# pixels0201522531041555610710Total100Input imagehistogramIntensity ( z )# pixels0511021532042051561075Total100Desired HistogramExampleUser defineOriginaldatar(nj)SPrs0200.21150.2522250.533100.644150.755550.866100.967101.07Histogram Matching Example Histogram Matching Example (cont.)(cont.)1. Apply Histogram Equalization to both tablesz(nj)SPzv050.0501100.1512150.323200.544200.755150.8566100.957751.07sk = T(rk)vk = G(zk)rs0112233445566677Histogram Matching Example Histogram Matching Example (cont.)(cont.)2. Get a mapvz0011224354657677sk = T(rk)zk = G-1(vk)r sv zs vWe getr z0112223344556576z # Pixels0012023031041551561070 Actual Output HistogramHistogram Matching Example (cont.)Histogram Matching Example (cont.)Desired histogramTransfer functionActual histogram(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Histogram Matching Example (cont.)Histogram Matching Example (cont.)OriginalimageAfterhistogram equalizationAfterhistogram matchingLocal Enhancement : Local Histogram EqualizationLocal Enhancement : Local Histogram EqualizationConcept: Perform histogram equalization in a small neighborhoodOrignal imageAfter Hist Eq.After Local Hist Eq.In 7x7 neighborhood(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Local Enhancement : Local Enhancement : Histogram Statistic for Image EnhancementHistogram Statistic for Image EnhancementWe can use statistic parameters such as Mean, Variance of Local area for image enhancementImage of tungsten filament taken usingAn electron microscopeIn the lower right corner, there is afilament in the background which isvery dark and we want this to be brighter.We cannot increase the brightness of the whole image since the white filament will be too bright.(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Local EnhancementLocal EnhancementExample: Local enhancement for this taskOriginal imageLocal Varianceimage Multiplicationfactor(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Local EnhancementLocal EnhancementOutput image(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Logic OperationsLogic OperationsANDORResult Region of InterestImage maskOriginalimageApplication:Crop areas of interest(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Arithmetic Operation: SubtractionArithmetic Operation: SubtractionError imageApplication: Error measurement(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Arithmetic Operation: Subtraction (cont.)Arithmetic Operation: Subtraction (cont.)Application: Mask mode radiography in angiography work(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Arithmetic Operation: Image AveragingArithmetic Operation: Image AveragingApplication : Noise reductionAveraging results in reduction of Noise varianceDegraded image(noise)Image averaging(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Arithmetic Operation: Image Averaging (cont.)Arithmetic Operation: Image Averaging (cont.)(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Sometime we need to manipulate values obtained from neighboring pixelsExample: How can we compute an average value of pixelsin a 3x3 region center at a pixel z?446761922275226445212133429577358222Pixel zImageBasics of Spatial FilteringBasics of Spatial Filtering446761922275226445212133429577358222Pixel zStep 1. Selected only needed pixels467691334Basics of Spatial Filtering (cont.)Basics of Spatial Filtering (cont.)467691334Step 2. Multiply every pixel by 1/9 and then sum up the values111111111XMask orWindow orTemplateBasics of Spatial Filtering (cont.)Basics of Spatial Filtering (cont.)Question: How to compute the 3x3 average values at every pixels?446761922275226445212133429577Solution: Imagine that we havea 3x3 window that can be placedeverywhere on the imageMasking WindowBasics of Spatial Filtering (cont.)Basics of Spatial Filtering (cont.)4.3Step 1: Move the window to the first location where we want to compute the average value and then select only pixels inside the window.446761922275226445212133429577Step 2: Computethe average valueSub image pOriginal image419223297Output imageStep 3: Place theresult at the pixelin the output image Step 4: Move the window to the next location and go to Step 2Basics of Spatial Filtering (cont.)Basics of Spatial Filtering (cont.) The 3x3 averaging method is one example of the mask operation or Spatial filtering.w The mask operation has the corresponding mask (sometimes called window or template).w The mask contains coefficients to be multiplied with pixelvalues.w(2,1) w(3,1)w(3,3)w(2,2)w(3,2)w(3,2)w(1,1)w(1,2)w(3,1)Mask coefficients111111111Example : moving averaging The mask of the 3x3 moving average filter has all coefficients = 1/9Basics of Spatial Filtering (cont.)Basics of Spatial Filtering (cont.)The mask operation at each point is performed by:1. Move the reference point (center) of mask to the location to be computed 2. Compute sum of products between mask coefficients and pixels in subimage under the mask.p(2,1)p(3,2)p(2,2)p(2,3)p(2,1)p(3,3)p(1,1)p(1,3)p(3,1)Subimagew(2,1) w(3,1)w(3,3)w(2,2)w(3,2)w(3,2)w(1,1)w(1,2)w(3,1)Mask coefficientsMask frameThe reference pointof the maskBasics of Spatial Filtering (cont.)Basics of Spatial Filtering (cont.)The spatial filtering on the whole image is given by:1.Move the mask over the image at each location.2.Compute sum of products between the mask coefficeints3.and pixels inside subimage under the mask.3.Store the results at the corresponding pixels of the 4.output image.4.Move the mask to the next location and go to step 25.until all pixel locations have been used.Basics of Spatial Filtering (cont.)Basics of Spatial Filtering (cont.)Examples of Spatial Filtering MasksExamples of the masksSobel operators011002-1-2-1-2 -11020-1011111111113x3 moving average filter-1 -1-18-1-1-1-1-13x3 sharpening filterSmoothing Linear Filter : Moving AverageSmoothing Linear Filter : Moving AverageApplication : noise reductionand image smoothingDisadvantage: lose sharp details(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Smoothing Linear Filter (cont.)Smoothing Linear Filter (cont.)(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Order-Statistic FiltersOrder-Statistic FilterssubimageOriginal imageMoving windowStatistic parametersMean, Median, Mode, Min, Max, Etc.Output imageOrder-Statistic Filters: Median FilterOrder-Statistic Filters: Median Filter(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Sharpening Spatial FiltersSharpening Spatial FiltersThere are intensity discontinuities near object edges in an image(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Laplacian Sharpening : How it worksLaplacian Sharpening : How it worksIntensity profile1st derivative2nd derivativep(x)EdgeLaplacian Sharpening : How it works (cont.)Laplacian Sharpening : How it works (cont.) Laplacian sharpening results in larger intensity discontinuity near the edge.p(x)Laplacian Sharpening : How it works (cont.)Laplacian Sharpening : How it works (cont.)p(x)Before sharpeningAfter sharpeningLaplacian MasksLaplacian Masks-1 -1-18-1-1-1-1-1-1004-1-10-10111-811111100-411010Application: Enhance edge, line, pointDisadvantage: Enhance noiseUsed for estimating image LaplacianorThe center of the mask is positiveThe center of the mask is negativeLaplacian Sharpening ExampleLaplacian Sharpening Examplep(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Laplacian Sharpening (cont.)Laplacian Sharpening (cont.)Mask for1 11-811111-1 -1-19-1-1-1-1-1-1 005-1-10-101 00-411010orMask foror(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.Unsharp Masking and High-Boost FilteringUnsharp Masking and High-Boost Filtering-1-1-1k+8-1-1-1-1-1-100k+4-1-10-10Equation:The center of the mask is negativeThe center of the mask is positiveUnsharp Masking and High-Boost Filtering (cont.)Unsharp Masking and High-Boost Filtering (cont.)(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.First Order DerivativeFirst Order Derivative2040608010012014016018020000.51050100150200-0.200.205010015020000.10.2Intensity profile1st derivative2nd derivativep(x)EdgesFirst Order Partial Derivative:First Order Partial Derivative:Sobel operators011002-1-2-1-2-11020-101PFirst Order Partial Derivative: Image GradientFirst Order Partial Derivative: Image GradientGradient magnitudeA gradient image emphasizes edges(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.First Order Partial Derivative: Image GradientFirst Order Partial Derivative: Image GradientPImage Enhancement in the Spatial Domain : Image Enhancement in the Spatial Domain : Mix things up !+-ASharpeningsmoothBECD(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.ECMultiplicationFImage Enhancement in the Spatial Domain : Image Enhancement in the Spatial Domain : Mix things up !ASGHPowerLaw Tr.(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号