Filter löschen
Filter löschen

How do I understand the different commands in the code?

1 Ansicht (letzte 30 Tage)
Vinay Chawla
Vinay Chawla am 29 Dez. 2020
Bearbeitet: Vinay Chawla am 29 Dez. 2020
Hello,
I am very new to MATLAB and image processing and I am researching extracting dimensions (Length and Width) from images of cracks of pavements. I believe image segmentation is required to determine the length and width. I am working on a code that I found online and it uses image enhamcement before segmentation. I was wondering if someone can assist me understanding the code and the parameters which are being used in the code (see below). The image enhancement uses a low-pass filter, applies the filter for noise removal and deblurring. I tried to use the code for the data I have but it does not seem to work. I was wondering if the filter and other parameters used were specific to the data. Do I change the filter size? Do I use a different filter? How is the for loop applied working and what is it doing?
I would appreciate any and every help I can get.
Thank you,
% Image enhancment
% First) 9*9 low pass filter
[f1,f2]=freqspace(size(I),'meshgrid');
D=100/size(I,1);
LPF = ones(9);
r=f1.^2+f2.^2;
for i=1:9
for j=1:9
t=r(i,j)/(D*D);
LPF(i,j)=exp(-t);
end
end
% Second) applying filter
Y=fft2(double(I)); Y=fftshift(Y);
Y=convn(Y,LPF); Y=ifftshift(Y);
I_en=ifft2(Y);
% Third)
I_en=imresize(I_en,size(I));
I_en=uint8(I_en);
I_en=imsubtract(I,I_en);
I_en=imadd(I_en,uint8(mean2(I)*ones(size(I))));

Antworten (0)

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by