Thursday, September 3, 2009

もう。。わかんない。 (Activity # 14)

Pattern recognition is the subject of Activity 14 and will probably be the subject for the next few activities.

In the context of image processing, it can be used to decide whether a feature vector (ordered set of attributes) of a pattern (a set of features) belongs to one of several classes (set of patterns sharing common properties).

Activity 14 makes use of the Minimum Distance Classification routine, where a pattern is assigned to the class whose mean or representative to it is nearest to. This can simply be done by either taking the minimum distances of the means for each sample, or by simply plotting out the means.

My original design for this activity was actually to implement the Scilab routine on an image of coins (30 coins, three classes - 25 centavo, 1 peso and 5 peso coins, and up to four features - size, R, G and B-channel color values). However, it seems absurd to do it straightforwardly, so I decided to test my algorithm on a Photoshop-generated image (based from the original coin image) of circles with three different brush sizes and three different color values in the Red. The fifteen patterns (five for each class) used for the training set were also obtained from the image of 30. All it took was a little playing around with the bwlabel() and find() functions.

As expected, the algorithm managed to sort the patterns out. Judging from the plot, there was a clear distinction between each pattern in the image, and that the deviation of the individual patterns from the training set was small.

When applied to coins however, although there is a clear distinction when it comes to size, the color values (not only in the red) were scattered all over the place. This is probably due to the uneven lighting in the image--there were shiny coins and there were dull coins. A better result can be obtained by capturing a better photo, especially with the use of reflectors and diffusers.

For my choice of a difficult image, and succeeding in sorting them out even if it's against it's will. xD I'm getting a 10.

No comments:

Post a Comment