Aurora Visio Studio TOP » Tutorial Exercises » Count the Mounts (count_mounts)
Count the Mounts (count_mounts)
Aim
Devise an application that counts the mounts in the provided picture.
Input
A single image with multiple mounts in it.
The input image is stored in the
count_the_mounts
directory.
Output
Return an Integer value with the count of objects depicted in the input image.
Hints
To solve this issue the Blob Analysis technique could be used. The mounts are much darker than the background so a basic image thresholding can be performed.
The image below shows the difference in the background and objects colors. Blue and violet colors represent black pixels. Red and orange colors represent white pixels in the image. As you can see, the background color is almost uniform (except for compression artifacts). To extract an object from the background ThresholdToRegion filter can be used.
Next, the found region should be split into separate objects. For this purpose SplitRegionIntoBlobs filter needs to be used. Then, a number of objects can be acquired directly from outBlobs output.
To get the count of the found elements outBlobs.Count output should be expanded as in the image below.
Labeling connections is explained in this article.
Solution (AVS)
- Add LoadImage filter to ACQUIRE section to get an image from the input directory.
- To extract objects from the image add ThresholdToRegion filter to PROCESS section and set the value of inMaxValue to 128 and inMinBlobArea set to Auto.
- To split the region into multiple objects use SplitRegionIntoBlobs filter.
- To get the number of blobs, right-click on outBlobs port and expand outBlobs.Count value.
- Display outBlobs.Count in a preview window.
Main Macrofilter uses a basic Blob Analysis technique to get a count of objects.
その他の資料
- Blob Analysis - Article presents detailed information about the Blob Analysis technique.