am getting error in result(r,:)=ifft2(imagefft.*filter); please help me ...
2 Comments
Answers (1)
ndata = cols;
logGabor(1:ndata/2+1) = exp((-(log(radius/fo)).^2) / (2 * log(sigmaOnf).^2));
so we know that logGabor is one longer than half of the number of columns. For example 480 columns would give logGabor of length 241.
filter = logGabor;
... and that's what the filter is.
for r = 1:rows % For each row signal = D(r,1:ndata); imagefft = fft2( signal ); result(r,:) = ifft2(imagefft .* filter)
Based on the for we can see that r is a scalar, so D(r,1:ndata) is one complete row out of D, a row vector.
fft2() of a row vector is an unusual thing to do, but it works out the same as fft() of the row vector. The result is a row vector of the same length, which in this case is the full number of columns of the image.
Now imagefft .* filter is a row vector the same width as the image, .* a row vector that is 1 more than half the number of columns. In the 480 example I gave above that would be (1 x 480) .* (1 x 241). That is an error.
It is possible that you want to use
filter = [logGabor, conj(fliplr(logGabor))]
or possibly
filter = [logGabor, fliplr(logGabor)]
if the idea is to filter the left and right halves of the fft result the same way. But if so then you need to be careful about what you do with the DC component in imagefft(1) which does not share in the symmetry of the fft. You would also need to pay close attention to whether the image was an odd number of columns or an even number of columns.
2 Comments
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!