Aurora Visio Studio TOP » Tutorial Exercises » Count Nails (nails)
Count Nails (nails)
Aim
Devise an algorithm that counts the nails present among various objects in an image.
Input
A single image with different objects present.
The input image is stored in the
nails
directory.
Output
An Integer value with number of found nails.
Expected value: 5
Hints
The backlight source makes objects very contrastive. Objects can be separated from the background very easily using the basic ThresholdToRegion filter.
Objects are physically separated and that makes it possible to split them into separate blobs using the SplitRegionIntoBlobs filter.
Regions can be classified using the ready-to-use ClassifyRegions tool which can be found in Toolbox, Region Analysis, Region Logic group.
Aurora Vision Studio also provides separate filters that can be used to classify blobs which can be found in Toolbox, Region Analysis, Region Feature group.
These filters can be very useful to preform classification using different regions' features.
Labeling connections is explained in this article.
Solution (AVS)
-
Add LoadImage filter to the project and select the input image path. It is also possible to drag an image file from outside of Aurora Vision Studio window.
-
To extract the objects from the image background add the ThresholdToRegion filter and set its inMaxValue to 200. Uncheck optional value in input inMinValue to set it to its default value.
-
To separate each object use SplitRegionIntoBlobs. Result of this operation is presented in the picture below. Each blob is displayed with a different color:
-
Experiment with different region features by adding multiple filters from the Region Features category.
-
Three different region features are presented in the picture below: RegionCircularity, RegionArea and RegionDiameter:
To show array indexes turn this option on in the top toolbar:
In this case the most useful feature is provided by the RegionDiameter filter and this value is used in further nails classification.
-
Add ClassifyRegions filter to the project, select DiameterLength option at inFeature input and choose appropriate values of inMinimum and inMaximum parameters.
-
Expand outAccepted output and show Count value in a new preview window.
Macrofilter Main counts nails among the other objects.
その他の資料
- Blob Analysis - Article presents detailed information about the Blob Analysis technique.