Can anyone verify this code for spectral magnitude error?

%%Input image
origimage = imread('greekchurch','jpg');
// Smoothing via gaussian lowpass
window = fspecial('gaussian', 3, 0.5);
distimage= origimage*window
// Fastfourier transform of image
fftA = fft2(double(origimage));
fftB = fft2(double(distimage));
[r c] = size(origimage);
for i=1:r
for j=i:j
result=abs(fftA)-abs(fftB);
result = result*result/rc;
end
end

5 Kommentare

That is not valid MATLAB code. MATLAB does not support // comments. It might be Octave code.
No it is a Matlab code that's just a typo mistake
If it is MATLAB code then I can verify immediately that it is incorrect. MATLAB code never uses // in any context other than strings or already in a comment.
If it is only approximately the code, then we can only approximately evaluate it; in that case flip a coin, Yes or No, it is valid or it isn't: either would be approximately correct.
No, i just have tried this by following concept of SME. By coding perspective i am not sure about it.
It seems like you're only reading comments, not any answers below. Any reason why not? Do I need to move my suggestion up here?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 25 Mai 2015

0 Stimmen

What do you want to achieve? Are you sure you want to subtract then square, and not square then subtract?

Gefragt:

am 25 Mai 2015

Kommentiert:

am 25 Mai 2015

Community Treasure Hunt

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

Start Hunting!

Translated by