 Download Download Presentation Exercise

# Exercise

Download Presentation ## Exercise

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. Exercise On lab1

2. NOTE • in C++ : // the comment is placed here, and colored in green Or /* placed here, and colored in green */ • Comment in matlab: % the comment is placed between percentage sign, and colored in green %

3. Read the image, convert it to grayscale image, and resize it to 512X512 • apply the sampling equation so that the image is resized by factors of 2 to reach 64X64. • Quantize the same image by reducing the gray levels by factors of 2 to reach 64X64.

4. Read the image, convert it to grayscale image, and resize it to 512X512. I = imread(‘……..’); % read% I1 = rgb2gray(I); % convert to grayscale % M = imresize(I1,[512 512]); % resize%

5. apply the sampling equation so that the image is resized by factors of 2 to reach 64X64. • 512 (29)  256 (28)  128 (27)  64(26) , So: • J = imresize(M, .5); % 512/2=256 % • K = imresize(J, .5); % 256/2=128 % • L = imresize(K, .5); % 128/2=64 % The first parameter is different in each resize step, and taken from the previous step.

6. Quantize the same image by reducing the gray levels by factors of 2 to reach 64X64. NOTE: in quantization always start from the image size. The image size in this example is 512 X1 = floor(M/2)*2; % 512/2 = 256 gray levels% X2 = floor(M/4)*4; % 512/4 = 128 gray level% X3 = floor(M/8)*8; % 512/8 = 64 gray level% This parameter is always the same, and represents the image size before the sampling This should be factors of 2when it is increase, the gray levels is decrease, and vise versa.

7. NOTE Factors of 2