We will continue with previous example, and in this tutorial, we will compute different features of labeled objects. As you previously realized, we have a 3 different object, each being represented by 4 pieces.
Original objects image
To differentiate between various objects, we will need features. For this example, we can use a shape, and color, where color is used to differentiate red and blue stars, and shape is to classify squares and stars.
For color feature we will simply use most dominant color in object histogram. For this purpose, we will need to calculate the histogram as we did in previous examples and choose the modus value. This can be replaced by computing the center of colors as well (you should try this).
Since the shape is not a real computable number, we will need to make algorithm, that can teach our computer, how to make a “shape” number. We will archive this by dividing perimeter of object and area of the object.
The perimeter of an object may be computed using a simple algorithm that scans each pixel of the object and if the four neighbor of the pixel contains the same values as the central pixel than this pixel does not contribute to the perimeter, otherwise it does. Area is then computing m(0,0).
Try to interpret F1 and F2 for each object inside the image.
Sollution in LV