| Developers' Corner

How to use the Feature Histogram

Screenshot of Feature Histogram
Screenshot of the HDevelop Feature Histogram

One of the most powerful tools in HDevelop is the Feature Histogram. The Feature Histogram is a very useful tool to get a feeling for the features of regions or contours. In many applications, it is necessary to select regions or contours depending on their shape. For example in case of classification, you are looking for the best features, which could be used to distinguish the different classes. However, the question arises, which feature should be used and which threshold should be applied. The Feature Histogram tool can give the answer to this question.

In the screenshot, the usual application of the Feature Histogram tool is shown. In the upper part of the image, you can see various objects of different shape. By means of the Feature Histogram, you can easily select the objects that are nearly circular. Take care that the green check mark is set on the left side of the feature name. This is necessary in order to visualize your settings.

In this specific example, the feature circularity is well suited to distinguish between the different objects. A suitable threshold for the separation of the object is about 0.95. The visualization of the feature values in the Feature Histogram enormously simplifies the selection of the suitable thresholds. In most cases it makes sense to set the color of the output objects to a specific color to increase the ease of inspection.

If one feature is not sufficient to select the requested object, it is possible to add further features to a feature list that could be used for the selection. Adding further features could be done by the plus button on the right top of the feature list. If several features are selected in the feature list, the logical operation ‘AND’ or ‘OR’ can be selected. If suitable features and the correct thresholds are selected, a simple click on the ‘Insert Code’ button exports the selection into your program.

A further, less known, possibility of the Feature Histogram is the possibility to redirect the output of the selection to a different window. This can be done in the section ‘Input and Output’.