Downsampling an image

조회 수: 24 (최근 30일)
Venkat R
Venkat R 2011년 4월 5일
Hi everybody,
I want to downsample a 49x49 image into 7x7 image using gaussian filter of 31x31. The alternate approach I tried (but not getting the accurate result) is as follows.
Any help is very much appreciated.
with regards, Venkat
clear all,clc
I = imresize(imread('pout.tif'),[49 49]); % I used matlab image as example of 49x49 image instead of my experiment image
hgausspymd = video.Pyramid;
hgausspymd.PyramidLevel = 3;
I_down = mat2gray(double(step(hgausspymd, I)));
imshow(I_down)
  댓글 수: 2
David Young
David Young 2011년 4월 5일
Why 31x31 for the filter? This is an enormous filter to apply to a 49x49 image, and will give rise to serious problems at the image boundaries, since it will only be wholly inside the image when centred on pixels in the middle 19x19 square.
Image Analyst
Image Analyst 2011년 9월 17일
Exactly what does "accurate" mean to you? As David says the final output image will be nearly all edge effects since very little will fit the 31x31 filter. There are a variety of ways to take edge effects into account. Which way do you prefer? Which way are you using when you define accuracy?

댓글을 달려면 로그인하십시오.

답변 (2개)

Oliver
Oliver 2011년 9월 17일
a(1:2:end,1:2:end)
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 9월 17일
That would downsample to 25 x 25 rather than 7 x 7, and would not use a gaussian filter as asked by the original poster.

댓글을 달려면 로그인하십시오.


Venkat R
Venkat R 2011년 9월 18일
Dear friends, thanks for your comments.
I am using the following code.
"accurate" means, should be able to summarize the information content in 49x49 images. Not just the peak/central regions etc
h = fspecial('gaussian',[31 31],3.5);
idown= imfilter(bw4,h,'symmetric');
bw4 is a 17x17 matrix. If I take first 7 alternative values in it, it is serving me the purpose
with regards, Venkat

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by