Saturday, September 12, 2009

Activity 14 Pattern Recognition

In image processing, it is important to distinguish sets of classes which share common features such as size, shape, color, and others. These sets of features are known as pattern and the process of determining the set of features that will enable the separation of a set into classes in called pattern recognition. In this activity, our task is to apply pattern recognition in images. Careful choice of the class features is important in this activity since it helps simplify our problem.

Mathematically, patterns maybe arranged into ordered sets such as feature vectors. If we let ωj, where j=1, 2, 3, …, W be a set of classes and W the total number of classes, we can define a representative of class ωj such that its mean feature vector is:

where xj is the set of all feature vectors in class ωj and Nj is the number of sampls in ωj. The class membership is determined by classifying an unknown feature vector x to the class whose mean is nearest to it. The Euclidean distance is used for this case and is equal to:

where is the ||y|| = (yTy)1/2 Euclidean norm [1].

The image [2] chosen for this activity is shown in Figure 1. As seen from the figure, the members of the entire class are dinosaurs of different types. From these dinosaurs, two classes are chosen and are shown in Figure 2. The figure consists of 5 blue dinosaurs and 5 red dinosaurs. The first three pictures of each row served as the training sets while the last two are the test objects. The classes are differentiated from each other in terms of color and area. For the first feature in our pattern recognition, the RGB values of each training sets are determined. Then, the normalized chromaticity for red (denoted as r_value) and the mean r_value for the two classes are calculated. For the second feature, i.e. area, the training objects are first converted to binary images (with proper thresholding). Using the code for area calculation in activity 2, the area of each training object and the mean area for each class are obtained. Table 1 shows a summary of the r_value and area for each training object.


Figure 1. Image used for pattern recognition [2]

Figure 2. Selected classes from image



Table 1. r_value and area of the training set.

To clearly see the separation between the two classes using the features selected, the r_values for differentarea of each training object are plotted and is shown in Figure 3. Notice that the separation between the classes is large enough to classify the objects. This signifies that the chosen features are reliable for pattern recognition.


Figure 3. Plot of r_values versus area of the training objects

For the test objects, the r_value and area are also calculated. Using Euclidean distance, test objects are classified as to what class they belong. The computed values and the classifications are shown in Table 2 and the plot of r_values vs. area is shown in Figure 4.

Table 2. Tabulated r_value and area of the test objects and their classifications

Figure 4. Plot of r_values vs. area of the test objects

From this activity, I was able to perform pattern recognition by supplying the right feature of each class and predicting the class from which the test objects belong. I would like to thank Kaye Vergel for that good discussion.

Since I am able to meet the objective of the activity, I give myself a grade of 10.



References:

1. Activity manual for Pattern recognition

2. http://www.craftkitsandsupplies.com/images/Foam_Shapes/Foam_Dinosaur_Shapes.jpg


No comments:

Post a Comment