feature extraction

5 views (last 30 days)
Shiwani Sawant
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.

Accepted Answer

Brett Shoelson
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
Shiwani Sawant
Shiwani Sawant on 14 Feb 2011
Thanks Brett,I hv tried a simple approach 4 coin recognition using radius computation and comparison.I hv written the code 4 radius computation.But m stuck up with a function to compare the radius.I used the 'isequal' fnction.It works well for comparison of numbers of upto 4 decimal places in the command window.But when used in my code,it gives me wrong answer...Can u help me?Or suggest any other fnction for the same?
Brett Shoelson
Brett Shoelson on 14 Feb 2011
That's where the histogramming comes in. Did you try that?
Brett

Sign in to comment.

More Answers (1)

Noel Mfinanga
Noel Mfinanga on 22 Jul 2020
How can I extract lake from a Landsat images

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!