I am trying to count different objects( cards, dice and dominoes ) in the image (first image is on which I am working and second image I got after some processing . Till now my code.... Please help me .

1 回表示 (過去 30 日間)
svpi2019_TP1_img_150_01.png
I=imread('svpi2019_TP1_img_150_01.png');
%%
figure(1)
imshow(I)
%%
BW=im2bw(I);
%%
% BW2 = bwareaopen(BW,100,8);
% imshow(BW2)
%%
% s = regionprops(BW,'all');
%%
L = bwlabel(BW);
%%
% imshow(L)
% hold on
% for k = 1:numel(s)
% c = s(k).Centroid;
% text(c(1), c(2), sprintf('%d', k), ...
% 'HorizontalAlignment', 'center', ...
% 'VerticalAlignment', 'middle');
% end
%%
figure(2)
measurements = regionprops(BW, 'BoundingBox', 'Area');
imshow(L)
for k = 1 : length(measurements)
thisBB = measurements(k).BoundingBox;
rectangle('Position', [thisBB(1),thisBB(2),thisBB(3),thisBB(4)],...
'EdgeColor','r','LineWidth',2 )
end
  2 件のコメント
KSSV
KSSV 2019 年 4 月 16 日
length(measurements)
gives you the number of objects.
kaushal sharma
kaushal sharma 2019 年 4 月 16 日
Thanks , But not the number for specifc type of object like how many cards are in the picture etc.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing and Computer Vision についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by