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.
Labeling connections is explained in this article.
Solution (FIS)
- Add the LoadImage filter.
- Add the ExtractBlobs_Intensity filter to extract each object from the background. Connect outImage output from a previous filter to inImage of the current one.
- Set inThresholdParams.Threshold to 200 to separate the darker parts from the brighter background.
- Set the inSplittingParams.MinArea parameter to 10 to find only these parts of required area and to make sure any noise is removed.
- Add the ClassifyRegions filter. Connect outBlobs from the previous filter to inRegions of the current one.
- Set inFeature to Elongation since it is one of the most distinctive features of nails. Please note that screws are not as long as nails, so set inMinimum to 10 to reject regions corresponding to screws.
- If you display the outBlobs output on the preview window and outValues on another one, please note that you can click on the button
marked below to toggle displaying indexes next to the image arrayed elements and relate parts' indexes with their corresponding values of elongation:
Macrofilter Main
Used Filters
Icon | Name | Description |
---|---|---|
![]() |
ExtractBlobs_Intensity | Segments an image into blobs by thresholding. |
![]() |
ClassifyRegions | Use this filter when you have an array of regions and you want to select some of them for further processing. |
Further Readings
- Blob Analysis - Article presents detailed information about the Blob Analysis technique.