【发布时间】:2015-10-11 10:27:39
【问题描述】:
我有一个二进制图像,我想删除大于阈值(如 50 像素)的白线。
原图:
输入输出图像:
我的想法:
我想计算位于每行中的白色像素,如果((白色像素数>阈值))则删除该行。
请编辑并完成我的代码。
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
【问题讨论】:
-
@Andy Jones 我应该删除我的问题吗?我遇到了问题,有人帮我解决了。
标签: image matlab binary noise-reduction