Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

why my binariation image appears like this ?

조회 수: 2 (최근 30일)
Bekhtaoui Abdelhakim
Bekhtaoui Abdelhakim 2019년 5월 27일
마감: MATLAB Answer Bot 2021년 8월 20일
hi evreyone please someone can tel me why my image after adaptive thres operation appears like that and how can i remove this white boundary ??
the code:
function [o] = adaptiveThres(a,W,noShow)
W=16;
%adaptiveThres(a,W);
[w,h] = size(a);
o = zeros(w,h);
%seperate it to W block
%step to w with step length W
for i=1:W:w
for j=1:W:h
mean_thres = 0;
%white is ridge -> large
if i+W-1 <= w & j+W-1 <= h
mean_thres = mean2(a(i:i+W-1,j:j+W-1));
%threshold value is choosed
mean_thres = 0.8*mean_thres;
%before binarization
%ridges are black, small intensity value -> 1 (white ridge)
%the background and valleys are white, large intensity value -> 0(black)
o(i:i+W-1,j:j+W-1) = a(i:i+W-1,j:j+W-1) < mean_thres;
end;
end;
end;
if nargin == 2
imshow(o);
imwrite(o,'C:\Users\home\Documents\PFE\method\BINimg.jpg');
end
thanks for helping
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 5월 27일
%seperate it to W block
That should tell you right there why you are having the problem. You are dividing the image up into W blocks by W blocks, and processing each one separately. The result is going to be blocky. You could reduce the size of the white border by increasing W.

답변 (0개)

이 질문은 마감되었습니다.

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by