You are here: Start » Tutorial Exercises » Classify the Mounts

Classify the Mounts

Aim:

Devise an algorithm that finds damaged mounts by analyzing the areas of blobs.

Input:

A single image with a set of mounts in it.

The input image is stored in the classify_mounts directory.

Output:

A set of regions that contains only damaged mounts.

Hints:

To solve this issue the Blob Analysis technique could be used. This exercise shows one of the typical computer vision problems. In order to extract the blobs from the background the ThresholdToRegion filter should be applied.

To extract a single region for each object use the SplitRegionIntoBlobs filter. To get only the damaged blobs, consider using the ClassifyRegions filter.

The CreateHistogram filter may be helpful in finding the invalid object area.

Labeling connections is explained in this article.

Solution (FIS):

  1. Add the LoadImage filter to ACQUIRE section to get an image from the input directory.

  2. To extract objects from the image add the ThresholdToRegion filter to the PROCESS section, set the value of the inMaxValue to 128 and the inMinValue to Auto.

  3. To split a single region into separate objects use the SplitRegionIntoBlobs filter. The output of this filter is an array of regions called Blobs.

  4. To select damaged mounts use the ClassifyRegions filter. Set the inFeature to Area because it is the feature on which the comparison of the blobs will be based.

  5. Add the CreateHistogram filter with the value of the inBinSize set to 25. The image below shows the distribution of region areas.

  6. Connect the outValues of ClassifyRegions filter to the inArray of the CreateHistogram filter.

    The image below shows preview windows configured to analyze the mounts' areas.

  7. Now the project can be executed. To find the boundary value of accepted area use the outHistogram output of the CreateHistogram filter.

  8. Set the inMaximum value of the ClassifyRegions to 2000.

Video Tutorial

Main macrofilter uses the Blob Analysis technique to find damaged mounts.

Further Readings

  • Blob Analysis - Article presents detailed information about the Blob Analysis technique.