How is this code binarizing an image?
Ältere Kommentare anzeigen
Is there anyone way someone would be able to explain to me what these for loops are doing to turn that image into binary?
%binarization
% im1 being the orignal image that is passed to this function
Radius=30;
intA=10;
lengthV=length(img1(:,1)); % vertical length
lengthH=length(img1(1,:)); horizontal length
for offV=1:lengthV/Radius % Vertical Offset
for offH=1:lengthH/Radius % Horizontal offset
% Convert region of radius Radius in a row
for i=1:Radius
for j=1:Radius
Obl((i-1)*Radius+j)=img1(j+(offV*Radius-Radius),i+(offH*Radius-Radius));
end
end
Obl;
Thres=mean(Obl)+intA; % Threshold
for i=1:Radius
for j=1:Radius
if img1(j+(offV*Radius-Radius),i+(offH*Radius-Radius)) > Thres
bw(j+(offV*Radius-Radius),i+(offH*Radius-Radius))=0;
else bw(j+(offV*Radius-Radius),i+(offH*Radius-Radius))=1;
end
end
end
end
end
bw;
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Neighborhood and Block Processing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!