|
|
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[WM]: Zero padding the FFT to resize
>
> Please help me as my case is time critical.
>
> I am implementing the Image Resizing algorithm.
> I read the letter below.
> Implemented the same but all in vein.Please tell me where i am wrong.
>
X 1000 !!!! :-(
By popular demand, here is example code of how to enlarge an image using an FFT:
% Copyright: Joseph O'Ruanaidh 2003, All Rights Reserved
% Disclaimer: not to be used for air traffic control
function y=fftResize(x, l)
ff=fft2(x);
[m,n]=size(ff);
ml = floor((l-1)*m/2)*2
mm = m + 2*ml
nl = floor((l-1)*n/2)*2
nn = n + 2*nl
% what will soon be the new transform
qq = zeros(mm, nn);
% The following indices copy from the original FFT to the new FFT if mod(m, 2)==0
xr = [1:m/2 ml+m/2+1 2*ml+((m/2+2):m)]
else
xr = [1:((m+1)/2) 2*ml+(((m+3)/2):m)]
end
if mod(n, 2)==0
yr = [1:n/2 nl+n/2+1 2*nl+((n/2+2):n)]
else
yr = [1:((n+1)/2) 2*nl+(((n+3)/2):n)]
end
% Do the copying and rescale the indices
qq(xr, yr) = ff*(mm*nn)/(m*n);
% And don't forget the most important part
y=ifft2(qq);
The results are not perfect due to Gibbs and his pesky phenomenon.
Now please let me live in peace, I beg of you.
Joe
______________________________________________________________________________
Watermarking Mailing List - http://www.watermarkingworld.org/ml.html
To unsubscribe send email to "majordomo@watermarkingworld.org" with
"unsubscribe watermarking YOURMAIL" in the body.
______________________________________________________________________________
|