feature extraction
5 views (last 30 days)
Show older comments
Shiwani Sawant
on 7 Feb 2011
Answered: Noel Mfinanga
on 22 Jul 2020
hi,i m working on coin recognition using feature extraction.i need the basic startup steps.i hv read a good deal on it.bt still it would be great if i wud get some small programs for any of feature extraction,chaincodes,texture computation,etc. to refer to.
0 Comments
Accepted Answer
Brett Shoelson
on 7 Feb 2011
Hi Shiwani,
I frequently present an advanced image processing course with coin recognition as the over-arching goal. Here are some ideas to get you started:
Basically, you'll want to start by measuring with a ruler or micrometer the coins you want to differentiate. Then, in the image of the coins, start with preprocessing; perhaps some noise reduction (MEDFILT2), perhaps normalization of illumination (IMTOPHAT). Then, you'll want to segment the coins using whatever segmetnation approahc makes sense. If the coins are touching, consider watershed transforms (WATERSHED; read this: http://www.mathworks.com/company/newsletters/news_notes/win02/watershed.html). Otherwise, if the coins are readily discernible from the bacground, perhaps simple thresholding will suffice (IM2BW, GRAYTHRESH). Clean up the mask of your coins; REGIONPROPS will be very useful. (Discard anything that is too large, too small, or too eccentric.) It will be very helpful to establish a length scale; perhaps you know the size of some object in the field of view? Once you have that, do some more blob analysis to calculate the sizes of the coin blobs. Scale those sizes (areas, equivalent diameters, or circumferences, or whatever measure you want to use) to actual (non-pixel) dimensions by multiplying by comparing to the object of know size. Then histogram the actual sizes of the detected coins, and calculate how many of each you have. Your histogram code might look like this:
[dollar,halfdollar,quarter,dime,nickel,penny] = ...
deal(PixPerInch * 67/64, ...
PixPerInch * 78/64, ...
PixPerInch * 60/64, ...
PixPerInch * 45/64, ...
PixPerInch * 54/64, ...
PixPerInch * 48/64); % Approx. coin sizes in 64ths of an inch
% SIZE-WISE: dimes, pennies, nickels, quarters, dollars, half-dollars
coinSizes = sort([dollar,halfdollar,quarter,dime,nickel,penny],'ascend');
L = bwlabel(objMask); %objMask is your segmented coin image
stats = regionprops(L, {'EquivDiameter', 'Centroid'});
sz = [stats.EquivDiameter];
X = sort(sz);
n = hist(X, coinSizes);
value = n(1) * 0.10 + ...
n(2) * 0.01 + ...
n(3) * 0.05 + ...
n(4) * 0.25 + ...
n(5) * 1.00 + ...
n(6) * 0.50;
HTH!
Brett
2 Comments
More Answers (1)
See Also
Categories
Find more on Language Support in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!