資源簡介
通過簡單的matlab程序對硬幣的數量和表示的數額進行分類,屬于簡單圖像識別的應用

代碼片段和文件信息
%%?COUNT?OF?COINS
%?Ing.?Diego?Barrag醤?Guerrero
%?www.matpic.com?-?www.eqbyte.com
%%?Convert?image?to?BW
coin1?=?im2bw(imread(‘coins.png‘));
%%?Fill?image?regions?and?holes
coin2?=?imfill(coin1‘holes‘);
%%?Label?and?count?connected?components
[L?Ne]=bwlabel(double(coin2));
%%?Measure?properties?of?image?regions
prop=regionprops(L‘Area‘‘Centroid‘);
%%?Counter
total=0;
%%?Show?image
imshow(imread(‘coins.png‘));hold?on
%%?Money?count?based?on?area?of?coin
for?n=1:size(prop1)?%For?1?to?Total?number?of?coins
????cent=prop(n).Centroid;
????X=cent(1);Y=cent(2);
????if?prop(n).Area>2000
????????text(X-10Y‘5?C‘)?
????????total=total+5;
????else
????????total=total+10;
????????text(X-10Y‘10?C‘)?
????end
end
hold?on
title([‘Total?of?money:?‘num2str(total)‘?Cents‘])
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2009-05-18?13:45??COUNT_OF_COINS\
?????文件???????70313??2009-02-09?04:29??COUNT_OF_COINS\coins.png
?????文件?????????803??2009-02-09?04:31??COUNT_OF_COINS\count_of_coins.m
?????文件????????1574??2009-05-18?13:45??license.txt
- 上一篇:菲涅爾衍射仿真matlab程序
- 下一篇:Matlab單像素成像算法比較
評論
共有 條評論