collect all same coins in each figure
2 ビュー (過去 30 日間)
古いコメントを表示
Dear all;
I want to collect all same value coins in each figure. For example, all 1 cent coin in 1 figure, all 5 cent coin in 1 figure. How can I do that?
Really appreciate for your help
clc;
close all;
clear;
I = imread("money.png");
Ig = rgb2gray(I);
imshow(Ig);
Ib = imbinarize(Ig,'global');
imshow(Ib);
se = strel('disk',2);
Ih = imerode(Ib,se);
Ih = Ib - Ih;
imshow (Ih);
If = imfill(Ih,'holes');
label = bwlabel(If);
max(max(label));
im1 = (label ==1);
figure;
imshow(im1)
for i = 1:max(max(label));
[row, col] = find(label ==i);
len = max(row)-min(row)+2;
breath = max(col)-min(col) +2;
target = uint8(zeros([len breath]));
sy = min(col) - 1;
sx = min(row) - 1;
for j = 1:size(row,1);
x = row(j,1) - sx;
y = col(j,1) - sy;
target(x,y) = I(row(j,1),col(j,1));
end
mytitle = strcat('Object Number:',num2str(j));
figure;
imshow(target);
end
0 件のコメント
回答 (1 件)
Image Analyst
2023 年 9 月 7 日
It's a generic, general purpose demo of how to threshold an image to find blobs, and then measure things about the blobs, and extract certain blobs based on their areas or diameters, like dimes or nickels only.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Convert Image Type についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!