how to count leaves?

조회 수: 3 (최근 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 CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by