How is this code binarizing an image?
이전 댓글 표시
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;
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Neighborhood and Block Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!