You are here: Start » Program Examples » Nails, Screws and Nuts

Nails, Screws and Nuts

Aim

The aim of the program is to distinguish nails from screws and nuts.

Input

The image of the parts.

Output

Detected nails and their dimensions.

Hints

In this example the easiest way to achieve the goal is to use Blob Analysis technique.

Solution (AVS)

  1. Add LoadImage filter.
  2. Add ThresholdToRegion filter. Connect outImage output from a previous filter with inImage of the current one.
  3. Click on the filter and set inMaxValue to 200 to separate the darker parts from the brighter background.
  4. Add SplitRegionIntoBlobs filter. Connect outRegion from a previous filter with inRegion of the current one.
  5. Click on the filter and set inMinBlobArea to 10 to find only these parts of required area.
  6. Add ClassifyRegions filter. Connect outBlobs from a previous filter with inRegions of the current one.
  7. Set inFeature to Elongation as it is the feature the most distinctive for nails and inMinimum to 10 so that nails are not confused with screws.

Macrofilter Main

Used Filters

Icon Name Description
ClassifyRegions Use this filter when to you have an array of regions and you want to select some of them for further processing.
ThresholdToRegion Extraction of a region of objects that can be defined by a salient brightness.
LoadImage Loads a single image from a file.
SplitRegionIntoBlobs Segmentation of a region into individual objects when the objects do not touch each other.

Further Readings

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