You are here: Start » Program Examples » Mounts (Segmentation)
Mounts (Segmentation)
Aim
This example shows the difference between Edge-based segmentation and Grayscale-based segmentation and how to get outer contours of blobs.
Input
An image of several mounts. There are also damaged mounts.
Output
An array of contours corresponding to the individual undamaged mount.
Solution (FIS)
-
Add EnumerateImages filter to get load an image of some disk directory.
-
Add SegmentImage_Edges filter to segment the image into blobs using image edges as their borders.
-
Blobs of the undamaged mounts have similar area, therefore set the inMinArea to 1800 and the inMaxArea to 3000, this causes in elimination of damaged mounts.
-
Add SegmentImage_Gray filter to segment the image into blobs examining difference between values of neighbouring pixels.
-
Set inMaxDifference to 100.
-
Set inDifferenceMeasure to Mean.
-
Specify the range of area of the undamaged mount. Set inMinArea to 2050 and inMaxArea to 3000.
-
Create a Step macrofilter DetectContour. Create the macrofilter's inputs of types Image and Region.
-
To close mount's holes, add DilateRegion filter and connect its input with the macrofilter input.
-
Add DetectEdges_AsPaths filter to extract the edges of the mount. Connect its input inRoi with an output of DilateRegion filter.
-
Add RegionMassCenter filter to compute a Mass Center point of the region.
-
To obtain an outer path of the mount, add SelectOuterPaths and connect its inputs with outEdges and outMassCenter.
-
Add GetArrayElement filter and extract the element with inIndex 0.
Macrofilter Main
Macrofilter DetectContour
Used Filters
Icon | Name | Description |
---|---|---|
![]() |
SegmentImage_Edges | Detection of objects of undefined shape, but characterized by good contrast to the background and fairly uniform internal brightness. |
![]() |
DetectEdges_AsPaths | Consistent detection of contours of variable or unpredictable shape, e.g. screw thread outline or a custom piece of textile. |
![]() |
GetArrayElement | Extracts a single element from an array at the specified index. |
![]() |
SelectOuterPaths | Selects paths which do not obstruct visibility of other paths from a point. |
![]() |
DilateRegion | Making the region thicker or filling-in small holes within it. |
![]() |
RegionMassCenter | Computes a point with coordinates equal to the average coordinates of the region's pixels. |
![]() |
LoadImage | Loads a single image from a file. |