I have a binary image which I want to remove white lines larger then Threshold value (like 50 pixel).
original image:
input and output image :
My idea:
I want to count white pixels which located in each rows and if (( number of white pixel > threshold value )) then remove that line.
please Edit and complete my code.
close all;clear all;clc;
I =imread('http://www.mathworks.com/matlabcentral/answers/uploaded_files/34446/1.jpg');
I=im2bw(I);
figure,
imshow(I);title('original');
ThresholdValue=50;
[row,col]=size(I);
count=0; % count number of white pixel
indexx=[]; % determine location of white lines which larger..
for i=1:col
for j=1:row
if I(i,j)==1
count=count+1; %count number of white pixel in each line
% I should determine line here
%need help here
else
count=0;
indexx=0;
end
if count>ThresholdValue
%remove corresponding line
%need help here
end
end
end