noise removing for image processing
Show older comments
Hi. I still in learning process. I want to remove noise in the image. I found this code where the noise successfully removed but the problem is I don't understand the code. I want to know how it work from row to row. Here the code that I had found.
I=imread('boy_noisy.gif'); %read the image
I=double(mat2gray(I)); %convert to double and change it to gray
I=imresize(I,[256 256]); %why should we re-size it?
[rows,cols]=size(I);
I=I-mean(I(:)); % I don't know the purpose for this code
f=fftshift(fft2(I));%use fourier transform
fabs=abs(f); % I don't know the purpose for this code
roi=3;thresh=400; I don't know the purpose for this function and why use roi?
le=ordfilt2(fabs,roi^2,ones(roi)); % use ordinal filter but I still don't understand this part
figure,imshow(le) %display
%I don't know all this part
r=(fabs==le)&(fabs>thresh);
[r,c]=find(r);
for i=1:length(result)
if (result (i)-128)^2+(c(i)-128)^2>400
f(result (i)-2:result(i)+2,c(i)-2:c(i)+2)=0;
Inew=ifft2(fftshift(f)); %inverse fourier transform
imagesc(real(Inew)),colormap(gray); % turn back the colour
1 Comment
William
on 3 Jan 2015
highlight code sections using the "{} code" button - makes it much easier to read and more likely to get answered
Accepted Answer
More Answers (0)
Categories
Find more on Frequency Transformations 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!