You are here: Start » Program Examples » Pattern Cutting
Pattern Cutting
Aim
The task is to detect the gaps in the grid pattern and fill them.
Input
An image with the grid pattern.
Output
Region representing the gaps in the input pattern.
Hints
To detect the gaps, at the beginning fill them using OpenImage and CloseImage filters. Then use ThresholdToRegion_Relative filter to identifies pixels representing the gaps.
Solution (FIS)
-
Add LoadImage filter to get load image of pattern.
-
To detect horizontal lines add CloseImage filter and set its input inRadiusY to 0.
-
Add OpenImage filter and connect its input to outImage. Set its input inRadiusY to 0.
-
To obtain an image with continuous horizontal lines, create a global parameter MaxGapLength of type Integer by clicking Create New Global Parameter... Set its value to 20.
-
Connect the created global parameter to inRadiusX inputs of both CloseImage and OpenImage filters.
-
Add another CloseImage filter and connect its input with the loaded image. Set inRadiusX to 0.
-
Add OpenImage filter and connect its input to outImage. Set inRadiusX to 0.
-
Connect the global parameter MaxGapLength to inRadiusY input ports of both CloseImage and OpenImage filters.
-
To compose horizontal and vertical lines add MinimumImage filter.
-
The last step is to extract a region representing the gaps. This can be achieved using ThresholdToRegion_Relative filter.
-
Connect inBaseImage to the output of MinimumImage.
-
Set inMinRelativeValue to 30. Drag the output outRegion and put it to the Data Preview Window to display the result.
Macrofilter Main
Used Filters
Icon | Name | Description |
---|---|---|
![]() |
ThresholdToRegion_Relative | Thresholds an image with a different threshold value for each pixel (inBaseImage(x, y) + inValue). |
![]() |
OpenImage | E.g. removal of the "salt" component of salt-and-pepper noise. |
![]() |
MinimumImage | Creates an image from the lower pixel values of each corresponding pair. |
![]() |
CloseImage | E.g. removal of the "pepper" component of salt-and-pepper noise. |
Further Readings
- Image Processing - A comprehensive introduction to Image Processing.