noise removing for image processing
显示 更早的评论
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 个评论
William
2015-1-3
highlight code sections using the "{} code" button - makes it much easier to read and more likely to get answered
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Frequency Transformations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!