Skip to main content
edited body
Source Link
Toygan
  • 177
  • 2
  • 10

I'm trying to decimate given picture enter image description here

  1. Vertically.
  2. Horizontally.
  3. Horizontally + Vertically.

I know that I should use low-pass filter* and then downsample** it not to see any aliasing in image. To this my code is below:

Horizontally filter:

filter_hor    = [0.25;025,0.5;05,0.25];
filtered_hor  = imfilter(big_shirt,filter_hor);%% big_shirt is shirt image given above
decimated_hor = filtered_hor(1:2:end,:);%%decimated_hor = downsample(filtered_hor,2);
imshow(decimated_hor)
title('Horizontally filtered')
axis on

Vertically filter:

filter_ver    = [0.25,025;0.5,05;0.25];
filtered_ver  = imfilter(big_shirt,filter_ver);
decimated_ver = filtered_ver(:,1:2:end);
imshow(decimated_ver)
title('Vertically filtered')
axis on

Horizontally + Vertically filter:

filtered_2D  = imfilter(decimated_hor,filter_ver);
decimated_2D = filtered_2D(:,1:2:end);
imshow(decimated_2D)
title('2D filtered')

What I get is :

enter image description here

enter image description here

enter image description here

*My low pass filter is: [0.25,0.5,0.25]

**By a factor of 2

My expectation is:

When I use horizontal filter, I just get rid of aliasing on lines of shirt collar.

When I use vertical filter, I just get rid of aliasing in vertically lines.

Vertical+horizontal will be nice picture like what I get.

However in first two cases are not satisfied. What can be the problem. My resolution on computer is 1366X768 and image size is 800X600. When I use imshow, I get:

Warning: Image is too big to fit on screen; displaying at 67% 

Can be problem related to this or am I doing something wrong?

I'm trying to decimate given picture enter image description here

  1. Vertically.
  2. Horizontally.
  3. Horizontally + Vertically.

I know that I should use low-pass filter* and then downsample** it not to see any aliasing in image. To this my code is below:

Horizontally filter:

filter_hor    = [0.25;0.5;0.25];
filtered_hor  = imfilter(big_shirt,filter_hor);%% big_shirt is shirt image given above
decimated_hor = filtered_hor(1:2:end,:);%%decimated_hor = downsample(filtered_hor,2);
imshow(decimated_hor)
title('Horizontally filtered')
axis on

Vertically filter:

filter_ver    = [0.25,0.5,0.25];
filtered_ver  = imfilter(big_shirt,filter_ver);
decimated_ver = filtered_ver(:,1:2:end);
imshow(decimated_ver)
title('Vertically filtered')
axis on

Horizontally + Vertically filter:

filtered_2D  = imfilter(decimated_hor,filter_ver);
decimated_2D = filtered_2D(:,1:2:end);
imshow(decimated_2D)
title('2D filtered')

What I get is :

enter image description here

enter image description here

enter image description here

*My low pass filter is: [0.25,0.5,0.25]

**By a factor of 2

My expectation is:

When I use horizontal filter, I just get rid of aliasing on lines of shirt collar.

When I use vertical filter, I just get rid of aliasing in vertically lines.

Vertical+horizontal will be nice picture like what I get.

However in first two cases are not satisfied. What can be the problem. My resolution on computer is 1366X768 and image size is 800X600. When I use imshow, I get:

Warning: Image is too big to fit on screen; displaying at 67% 

Can be problem related to this or am I doing something wrong?

I'm trying to decimate given picture enter image description here

  1. Vertically.
  2. Horizontally.
  3. Horizontally + Vertically.

I know that I should use low-pass filter* and then downsample** it not to see any aliasing in image. To this my code is below:

Horizontally filter:

filter_hor    = [0.25,0.5,0.25];
filtered_hor  = imfilter(big_shirt,filter_hor);%% big_shirt is shirt image given above
decimated_hor = filtered_hor(1:2:end,:);%%decimated_hor = downsample(filtered_hor,2);
imshow(decimated_hor)
title('Horizontally filtered')
axis on

Vertically filter:

filter_ver    = [0.25;0.5;0.25];
filtered_ver  = imfilter(big_shirt,filter_ver);
decimated_ver = filtered_ver(:,1:2:end);
imshow(decimated_ver)
title('Vertically filtered')
axis on

Horizontally + Vertically filter:

filtered_2D  = imfilter(decimated_hor,filter_ver);
decimated_2D = filtered_2D(:,1:2:end);
imshow(decimated_2D)
title('2D filtered')

What I get is :

enter image description here

enter image description here

enter image description here

*My low pass filter is: [0.25,0.5,0.25]

**By a factor of 2

My expectation is:

When I use horizontal filter, I just get rid of aliasing on lines of shirt collar.

When I use vertical filter, I just get rid of aliasing in vertically lines.

Vertical+horizontal will be nice picture like what I get.

However in first two cases are not satisfied. What can be the problem. My resolution on computer is 1366X768 and image size is 800X600. When I use imshow, I get:

Warning: Image is too big to fit on screen; displaying at 67% 

Can be problem related to this or am I doing something wrong?

Source Link
Toygan
  • 177
  • 2
  • 10

MATLAB: Decimation image

I'm trying to decimate given picture enter image description here

  1. Vertically.
  2. Horizontally.
  3. Horizontally + Vertically.

I know that I should use low-pass filter* and then downsample** it not to see any aliasing in image. To this my code is below:

Horizontally filter:

filter_hor    = [0.25;0.5;0.25];
filtered_hor  = imfilter(big_shirt,filter_hor);%% big_shirt is shirt image given above
decimated_hor = filtered_hor(1:2:end,:);%%decimated_hor = downsample(filtered_hor,2);
imshow(decimated_hor)
title('Horizontally filtered')
axis on

Vertically filter:

filter_ver    = [0.25,0.5,0.25];
filtered_ver  = imfilter(big_shirt,filter_ver);
decimated_ver = filtered_ver(:,1:2:end);
imshow(decimated_ver)
title('Vertically filtered')
axis on

Horizontally + Vertically filter:

filtered_2D  = imfilter(decimated_hor,filter_ver);
decimated_2D = filtered_2D(:,1:2:end);
imshow(decimated_2D)
title('2D filtered')

What I get is :

enter image description here

enter image description here

enter image description here

*My low pass filter is: [0.25,0.5,0.25]

**By a factor of 2

My expectation is:

When I use horizontal filter, I just get rid of aliasing on lines of shirt collar.

When I use vertical filter, I just get rid of aliasing in vertically lines.

Vertical+horizontal will be nice picture like what I get.

However in first two cases are not satisfied. What can be the problem. My resolution on computer is 1366X768 and image size is 800X600. When I use imshow, I get:

Warning: Image is too big to fit on screen; displaying at 67% 

Can be problem related to this or am I doing something wrong?