Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

why my binariation image appears like this ?

1 visualización (últimos 30 días)
Bekhtaoui Abdelhakim
Bekhtaoui Abdelhakim el 27 de Mayo de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 comentario
Walter Roberson
Walter Roberson el 27 de Mayo de 2019
%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.

Respuestas (0)

La pregunta está cerrada.

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by