Feature extraction
Now, let's extract the features of each object. To understand the feature concept of a feature vector, we will extract very simple features, but it is enough to get good results. In other solutions, we can get more complex features, such as texture descriptors, contour descriptors, and so on.
In our example, we only have these three types of objects, nuts, rings, and screws, in different possible positions. All these possible objects and positions are shown in the following figure:
We will explore the good characteristics that will help the computer to identify each object. The characteristics are as follows:
The area of an object
The aspect ratio, which is the width divided by the height of the bounding rectangle
The number of holes
The number of contour sides
These characteristics can describe our objects very well, and if we use all of them, the classification error can be very small. However, in our implemented example, we will use only the first two characteristics, the...