Anti-Aliasing Filter for matlab imresize
15 views (last 30 days)
Show older comments
Hello, I am doing a project on computer graphics and have been asked to implement the matlab's imresize function in C++, using bicubic interpolation. As you know, if the scale factor is less than one, we need a anti-aliasing filter while interpolation. However I have no experience in filter design and at the moment I'm still relatively new to matlab and the image processing toolbox. I've tried using the fspecial gaussian filter but it doesnt seem to have much effect. Can you give me any tips on how to produce an appropriate filter in matlab, or point me to relevant information. Any help is appeciated, many thanks, Xifei WU 2011.6.15
0 Comments
Answers (2)
Jan
on 15 Jun 2011
You can inspect the source code of IMRESIZE to see how Matlab solves the problem.
0 Comments
Tobias Pahlberg
on 21 Nov 2013
I opened imresize_old.m and below is the part where the antialiasing-filter is constructed for downsampling.
function b = DesignFilter(N,Wn)
% Modified from Signal Processing Toolbox v3 fir1.m and hanning.m
% first creates only first half of the filter
% and later mirrows it to the other half
odd = rem(N,2);
vec = 1:floor(N/2);
vec2 = pi*(vec-(1-odd)/2);
wind = .54-.46*cos(2*pi*(vec-1)/(N-1));
b = [fliplr(sin(Wn*vec2)./vec2).*wind Wn];% first half is ready
b = b([vec floor(N/2)+(1:odd) fliplr(vec)]);% entire filter
b = b/abs(polyval(b,1));% norm
But why is the Hanning window used with those settings and is there any bicubic filtering done here?
0 Comments
See Also
Categories
Find more on Geometric Transformation and Image Registration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!