Overlapped Objects Counting From an Image

1 回表示 (過去 30 日間)
Md Hafizur Rahman
Md Hafizur Rahman 2020 年 2 月 18 日
I want to count tiny line objects in the following image. There are three lines but my program counts two. How can I count three tiny line objects from the image?
Code:
I=imread('d1.png');
figure; imshow(I);
J = rgb2gray(I);
Y=im2bw(B,0.45);
C = imcomplement(Y);
X = bwpropfilt(C, 'MinorAxisLength',[0 350]);
Z = bwpropfilt(X, 'MajorAxisLength',[250 1000]);
L = bwlabel(Z);
s = regionprops(L, 'Centroid');
figure
imshow(Z)
for k = 1:numel(s)
c = s(k).Centroid;
text(c(1), c(2), sprintf('%d', k),'Color', 'g', ...
'HorizontalAlignment', 'center', ...
'VerticalAlignment', 'middle');
end
The ouput image:

回答 (0 件)

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by