ECE 525.674 Image Processing and Analysis Prof. John Goutsias Assignment #1 Please READ instructions at the end of assignment 1. For each input-output relationship given below, determine whether the corresponding image processor is linear/shift invariant. (a) g ( x , y ) f ( x , y ) f ( x z , y ) . (b) g( x ) z f ( x, z )dz . (c) g ( m, n ) f ( m, 1) f ( m, 0 ) f ( m,1) 2. Given a continuous image f ( x , y ) ( x y )3 , compute images g1 ( x, y ) f ( x, y ) ( x 1, y 2) and g 2 ( x, y ) f ( x, y ) ( x 1, y 2) . 3. Convolve the discrete image f ( m, n ) a m n u( m, n ) with the discrete image h( m, n ) ( m rM , n rN ) , where u( m, n ) is the unit step sequence, defined by r 1, if m 0 and n 0 u (m, n) . 0, otherwise 4. Consider two images f ( x , y ) and g ( x , y ) that are separable, i.e., such that f ( x , y ) f1 ( x ) f 2 ( y ) and g ( x , y ) g1 ( x ) g 2 ( y ) . Is their convolution a separable image? Express their convolution in terms of f1 , f 2 , g1 , and g2 . 5. Compute the Fourier transforms of the following 2-D continuous images (a) f ( x, y ) sin(2 ax ) cos(2 y ) . (b) f ( x, y ) cos(2 ( ax y )) . 6. If F ( u, v ) is the Fourier transform of the continuous image f ( x , y ) , compute the Fourier transform of the continuous image f ( ax, by ) for any constants a and b . How do the values of a and b affect the image f ( x , y ) ? 7. If F ( u, v ) is the Fourier transform of the continuous image f ( x , y ) , compute the Fourier transform of the continuous image f ( ax by , cx dy ) when a, b, c, d are such that ad bc 1. 1 8. For the imaging system shown below, with a, b 0 , show that the output image g ( x , y ) is a scaled and inverted replica of the input. f ( x, y ) f ( ax , by ) scaling F F g( x, y ) 9. Calculate the convolution ( f h )( m, n ) , where: Note that the image f ( m, n ) is 0 at all pixels, except at those pixels indicated by the black dots at which the value is 1. On the other hand, image h ( m, n ) takes value 0 at all pixels, except at those pixels indicated by the black dots at which the values are shown within the parentheses. 10. The Fourier transform F ( u, v ) of a discrete image f ( m, n ) is given by F ( u, v ) 3 2 cos( 2 u ) 4 j sin( 2 v ) 8e j 2 ( u v ) . Determine f ( m, n ) . 11. Consider the following discrete image f ( m, n ) , taking value 0 at all pixels, except at those pixels indicated by the black dots at which the values (which are all real) are shown within the parentheses. 2 (a) What can you say about F ( u, v ) without explicitly computing it? (b) Determine F( 0,0 ) . (c) Determine F ( u, v ) . 12. (MATLAB) For each image file image1.bmp, image2.jpg, and image3.jpg: (a) Determine its type (binary, grayscale, or colored). (b) Determine its size. (c) Determine the maximum and minimum grayscale values. (d) Determine the number of bits required to represent the raw information. (e) Use the imwrite function of MATLAB to write image3.jpg into files of type TIFF, BMP and PNG. How many bytes each file (including the original) occupies on the hard disk? What do you observe? 13. (MATLAB) (a) By using the imresize function of MATLAB, demonstrate for image4.jpg the effect of reducing the sample grid size by a factor of 2, 4 and 8. To see the effect, the resulting images must be displayed using the same size as of the original image. Mark the number of pixels associated with each image. (b) By using the grayslice function of MATLAB, quantize image2.jpg into 256, 128, 64, 32, 16, 8, 4, and 2 gray levels. At which number of gray levels you start observing significant distortion? 14. (MATLAB) (a) Generate a 256 256 pixel binary image that contains a disk of radius 15 located at the center of the image. By using the fft2 function of MATLAB, compute and display the magnitude of its Fourier transform. The resulting magnitude is subject to ringing, why? Gently modify the disk to reduce the ringing effect. (b) Convolve image4.jpg with a 2-D image processor whose point-spread sequence is a 512 512 pixel zero-mean Gaussian curve with standard deviation 4 (using the fspecial function of MATLAB). What do you observe? Show that the result is the same if the image processor is implemented in the frequency domain. INSTRUCTIONS 1. 2. 3. 4. Each problem carries 10 points. You need to solve only 7 of problems 1-11. If you solve additional problems, you will receive more points. The images required to complete the MATLAB problems can be downloaded from http://www.cis.jhu.edu/~goutsias/temp/ipdata.zip 5. You must include ALL results (images, explanations, and answers to questions) associated with each problem, as well as your MATLAB code. 3 6. Your work (including the MATLAB code) should be submitted as ONE file using the following convention: LastName-FirstName-Asgmt#.pdf, where # is the assignment number (1, 2, etc). 4