how to count leaves?

1 回表示 (過去 30 日間)
Keane Athallah
Keane Athallah 2022 年 5 月 19 日
コメント済み: Keane Athallah 2022 年 5 月 20 日

採用された回答

yanqi liu
yanqi liu 2022 年 5 月 20 日
yes,sir,what is leaves,is it the bigger area,may be use image segment,such as
im = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1004330/image.jpeg');
im = imcrop(im, [210 125 540 350]);
bw = im2bw(im);
bw2 = bwareaopen(bw, 100);
stats = regionprops(bw2);
figure; imshow(im); hold on;
for i = 1 : length(stats)
hold on; rectangle('position', stats(i).BoundingBox, 'EdgeColor', 'g', 'LineWidth', 2)
cen = stats(i).Centroid;
text(cen(1), cen(2), num2str(i), 'Color', 'r');
end
title(sprintf('total number is %d', length(stats)));
  1 件のコメント
Keane Athallah
Keane Athallah 2022 年 5 月 20 日
thank you so much

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by