Baixe Resolucao de exercicios capitulo 3 e outras Exercícios em PDF para Processamento de Imagem Digital, somente na Docsity! EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Image Enhancement in the Spatial Domain • Example 1(PR3.1): Exponentials of the form e-ar2, a a positive constant, are useful for constructing smooth gray-level transformation functions. Construct the transformation functions having the general shapes shown in the following figures. The constants shown are input parameters, and your proposed transformations must include them in their specifications. A A/2 L0 s=T(r) r (a) B B/2 L0 s=T(r) r (b) D C L0 s=T(r) r (c) (a) General form of the function: 2 )( rAerTs a 2/ 2 0 AAe L a In Figure (a): solving for a : 2 0 2 0 /693.0 693.0)5.0ln( L L a a Then: 2 2 0 693.0 )( r L AerTs EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Image Enhancement in the Spatial Domain • Example 1(PR3.1): B B/2 L0 s=T(r) r (b) (b) General form of the function: 2 2 1r rs T( r ) B Be B( e )a a In Figure (b): Then: 2 0 2 0 /693.0 693.0)5.0ln( L L a a )1()( 2 2 0 693.0 r L eBrTs 2/)1( 2 0 BeB L a (c) General form of the function: D C L0 s=T(r) r (c) CeCDrTs r L )1)(()( 2 2 0 693.0 EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD 0 50 100 150 200 250 0 50 100 150 200 250 Image Enhancement in the Spatial Domain • Example 2(PR3.3): Consider Bit plane 6: 6 7255 2 mod( ,2 ) ( ) 0 for r T r otherwise r s s=T(r) 250=11001110 31=00011111 111=01101111 190=10111110 Note that all the 1s corresponding to bit 6 are scaled to 255 and all the bits corresponding to 0s are scaled down to 0. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Image Enhancement in the Spatial Domain • Example 3(PR3.4): a) What effect would setting to zero the lower-order bit planes have on the histogram of an image in general? • b) What would be the effect on the histogram if we set to zero the higher- order bit planes instead? All the bits included a) Removing the low order bit planes would mean the loss of some high frequency details. Furthermore the image histogram will be more sparse as compared with the all 8-bit plane case. 0 50 100 150 200 250 0 200 400 600 800 1000 0 50 100 150 200 250 0 500 1000 1500 2000 2 of the LSBs removed This is because, there will be no component representing intermediate pixel values such as 1,2,3,4, 5, 6,7 and 9,10,11,12,13,14,15 etc. Instead there will be 0 and 8 and 16 etc. This would cause the height some of the remaining histogram peaks to increase in general. Typically, less variability in gray level values will reduce contrast. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Image Enhancement in the Spatial Domain • Example 3(PR3.4): b) What would be the effect on the histogram if we set to zero the higher-order bit planes instead? All the bits included b) Removing the high order bit planes would mean the loss of some very important DC components away from the image. 0 50 100 150 200 250 0 200 400 600 800 1000 MSB removed 0 50 100 150 200 250 0 200 400 600 800 1000 1200 The meaning of this is that the image is much darker and a lot of the low frequency components will be lost. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Image Enhancement in the Spatial Domain • Example 6(PR3.22): The three images shown below were blurred using the square averaging masks of sizes n=23, 25 and 45 respectively. The vertical bars on the lower part of (a) and (c) are blurred, but clear separation exists between them. However, the bars have merged in in image (b), in spite of the fact that the mask that produced the image is significantly smaller than the mask produced image (c) .Explain this. • (Note that the vertical bars are 5 pixels wide and 20 pixels apart.) (a) (b) (c) Original image EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Image Enhancement in the Spatial Domain • Example 6(PR3.22): Note that the vertical bars are 5 pixels wide and 20 pixels apart. (a) (b) (c) The reason why the mask with size n=25 producing merged uniform region around the bars is because of the sizes of the bars and the separation of the bars in the horizontal direction. The width of each bar is 5 pixels and each bar is separated by 20 pixels. In such an environment as the mask moves in the horizontal direction there will be 5 black and 20 light gray pixels in each row at a time. This will provide the same average value for each pixel in the region producing a merged uniform gray level. However this will not be the same in 23 and 45 pixel masks!! EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Image Enhancement in the Spatial Domain • Example 7(PR3.24): In a given application an averaging mask is applied to input images to reduce noise, and then a Laplacian mask is applied to enhance small details. Would the result be the same if the order of these operations were reversed? Laplacian operation and averaging can be expressed by the following 3x3 masks: ),(4)1,()1,(),1(),1(),( yxfyxfyxfyxfyxfyxgLaplacian 9 1 1 ( , ) 9 i i Averaging h x y f Both of the two operators are multiplying the pixels in a 3x3 neighborhood with constant numbers and perform the addition. Therefore, these operations are linear operations. The order of two linear operations does not matter. The result would be same in any order. 0 1 0 1 -4 1 0 1 0 1/9 1/9 1/9 1/9 1/9 1/9 1/9 1/9 1/9 Laplacian Mask Averaging Mask EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Image Enhancement in the Spatial Domain • Example 9(PR4.7): What is the source of nearly periodic bright points in the horizontal axis of the spectrum in the following figure. The nearly periodic bright points in the frequency spectrum corresponds to the periodic bars as well as the repeating boxes, letters and circles in the horizontal direction. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Image Enhancement in the Spatial Domain • Example 10(PR4.6) -a): Prove the validity of the following Equation. TransformFourierthedenotesNvMuFyxf yx [.],)2/,2/(])1)(,([ 1 1 2 0 0 1 M N j π( ux / M vy / N ) x y F(u,v ) f ( x, y )e MN 1jπ( x y ) x y jπ( x y )e ( ) e cos(π( x y )) j sin(π( x y )) 1 1 2 2 2 0 0 1 2 2 M N j π(( u M / )x / M ( v N / )y / N ) x y F(u M / ,v N / ) f ( x, y )e MN 1 1 2 1 2 1 2 0 0 1 M N j π(( ux / M / x ) ( vy / N / y )) x y f ( x, y )e MN )//(2)//(2)())2/1/()2/1/((2 )1( NvyMuxjyxNvyMuxjyxjyNvyxMuxj eeee always zero 1 or -1 depending on the addition of x+y. If (x+y) is even then 1, otherwise -1. 1 1 2 0 0 1 1 M N x y j π( ux / M vy / N ) x y f ( x, y )( ) e MN EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Image Enhancement in the Spatial Domain • Example 10(PR4.6) -b): Prove the validity of the following 2 Equations. ),(),( 00 )//(2 00 vvuuFeyxf NyvMxuj )//(2 1 0 1 0 )//(2)//(2 0000 ),( 1 ]),([ NvyMuxj M x N y NyvMxujNyvMxuj eeyxf MN eyxf )//(2 00 00),(),( NvyMuxj evuFyyxxf Similarly, it can be shown that : ),(]),([ 00 )//(2 00 yyxxfevuF NvyMuxj This is the Translation property of the 2D Fourier transform: When x0=u0=M/2 and x0=u0=N/2, then )2/,2/()1)(,( NvMuFyxf yx vuvuFNyMxf )1)(,()2/,2/( 1 0 1 0 )/][/]([2 00),( 1 M x N y NyvvMxuuj eyxf MN ),( 00 vvuuF EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Image Enhancement in the Spatial Domain a) The H(u,v) Filter function can be centered by: • Example 12(PR4.14): Suppose that you form a low pass filter that averages the four immediate neighbors of a point (x,y), but excludes the point itself. • (a) Find the equivalent filter H(u,v) in the frequency domain. • (b) Show that H(u,v) is a lowpass filter. b) Consider one variable for convenience. As u ranges from 0 to M, the value of cos(2π[u-M/2]/M) starts at -1, peaks at 1 when u = M/2 (the center of the filter) and then decreases to -1 again when u = M. Thus, we see that the amplitude of the filter decreases as a function of distance from the origin of the centered filter, which is the characteristic of a lowpass filter. A similar argument is easily carried out when considering both variables simultaneously. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Image Enhancement in the Spatial Domain • Example 8-PR4.19: Derive the frequency domain filter that corresponds to the Laplacian operator in the spatial domain. Consider theLaplacian mask given. Then, Where The H(u,v) Filter function can be centered by: EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Image Enhancement in the Spatial Domain • Example 8-PR4.22: The two fourier spectra shown are of the same image. The spectrum of the left corresponds to the original image, and the spectrum on the right was obtained after the image was padded with zeros. • (a) Explain the difference of the overall contrast. • (b) Explain the significant increase in signal strength along the vertical and the horizontal axes of the spectrum shown on the right. (a) Padding with zero increases the size but reduces the average gray level of image. The average gray level of the padded image is less than the original image. F(0,0) in the padded image is less than F(0,0) of the original image. All the others away from the origin are less in the padded image than the original image. This produces a narrower range of values hence a lower contrast spectrum in the padded image. (b) Padding with 0’s introduces significant discontinuities at the borders of the original image. This process introduces strong horizontal and vertical edges where the image ends abruptly and then continues with o values. These sharp transitions correspond to the strength of the spectrum along the horizontal and vertical axes.