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:
A region representing the gaps in the input pattern.

Hints:
Solution (FIS):
►Click here to show the solution.
▼Click here to hide the solution.
-
In Workspace Explorer, open the workspace Examples, and in the Filmstrip window, select the PatternCutting dataset. Drag the Image channel to the ACQUIRE section.
-
To detect horizontal lines, add the CloseImage filter and set its input inRadiusY to 0.
-
Add the OpenImage filter and connect its input to the 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 the inRadiusX inputs of both CloseImage and OpenImage filters.
-
Add another CloseImage filter and connect its input with the loaded image. Set the inRadiusX to 0.
-
Add the OpenImage filter and connect its input to the outImage. Set the inRadiusX to 0.
-
Connect the global parameter MaxGapLength to the inRadiusY input ports of both CloseImage and OpenImage filters.
-
To compose horizontal and vertical lines, add the MinimumImage filter.
- Connect its inImage1 input to the outImage of the OpenImage
filter, which is responsible for filling gaps in the horizontal lines.
- Connect its inImage2 input to the outImage of the OpenImage
filter, which is responsible for filling gaps in the vertical lines.
-
The last step is to extract a region representing the gaps. This can be achieved using ThresholdToRegion_Relative filter.
-
Connect the inImage to the output of the ReadFilmstrip filter.
-
Connect the inBaseImage to the output of the MinimumImage.
-
Set the inMinRelativeValue to 30. Drag the outRegion output and put it in the Data Preview
Window to display the result.
Macrofilter Main

Used Filters
►Click here to show the filters list.
▼Click here to hide the filters list.
Icon |
Name |
Description |
 |
CloseImage |
E.g. removal of the "pepper" component of salt-and-pepper noise. |
 |
MinimumImage |
Creates an image from the lower pixel values of each corresponding pair. |
 |
OpenImage |
E.g. removal of the "salt" component of salt-and-pepper noise. |
 |
ThresholdToRegion_Relative |
Thresholds an image with a different threshold value for each pixel (inBaseImage(x, y) + inValue). |
Further Readings