You are here: Start » Program Examples » Parallel Enumeration
Parallel Enumeration
Aim:
The task of this example is to check the number of bottles, their orientation, level of liquid, and presence of foam in the shortest possible execution time using Worker Task Macrofilters.
Input:
An image of bottles. The position of the bottles may change both in relation to the camera as well as to other bottles.
Output:
An image with the result of the inspections drawn. If a defect is detected, a rectangle is drawn around it.
Hints:
The location of the object is variable. Inspection steps of this program have been described in the Bottle Inspection example.
Compared to the original example, in order to reduce execution time, image enumeration should be performed in parallel to the inspection.
To achieve this, a Worker Task Macrofilter should be used.
Labeling connections is explained in this article.
Solution (FIS):
-
Load the program from the Bottle Inspection example.
-
From the Project Explorer window, create a new Worker Task Macrofilter named ImageEnumerator.
-
From the Project Explorer window, create a new ImageToInspect queue with Image data type.
-
Go to the ImageEnumerator Worker Task Macrofilter and in the ACQUIRE section, add the EnumerateImages filter.
-
Provide a proper path to the images in the inDirectory input.
-
In the PROCESS section, add the Queue_Push filter and assign the ImageToInspect queue to it.
-
Connect the outImage output from the EnumerateImages filter to the inValue input of the Queue_Push filter.
-
Go back to the Main program.
-
In the ACQUIRE section, add the Queue_Pop filter and assign the ImageToInspect queue to it.
-
Replace the connection from the outImage output with a connection from the outValue output of the Queue_Pop filter.
-
Remove or disable the EnumerateImages filter in Main.
-
Add the Loop filter in the ACQUIRE section.
-
The program is ready to use. In the current version, programs using worker tasks can be properly run only in the Run mode (F5)
Macrofilter Main
Macrofilter ImageEnumerator
Used Filters
Icon | Name | Description |
---|---|---|
![]() |
AlignRectangle | Required when there is a rectangle defined in a local coordinate system, but the next image-related filter in the program does not have any inAlignment input. |
![]() |
CheckPresence_Intensity | Quick and easy presence verification, e.g. for missing caps, screws, labels. |
![]() |
CreateCoordinateSystemFromPoint | Most often used to define an object alignment from results of 1D Edge Detection or Blob Analysis. |
![]() |
CreateRectangle | Creates a rectangle from an aligned point. |
![]() |
EnumerateImages | Emulates image acquisition with images stored on disk. |
![]() |
LocateSingleObject_Edges1 | Detection of an object whose outlines are sharp and rigid. Often one of the first filters in a program. |
![]() |
Loop | Put this filter into a task that should have a loop, but does not have any other loop generators (e.g. GrabImage). |
![]() |
ScanMultipleStripes | Very fast detection of multiple pairs of opposite edges - usually for counting or width measurements. |
![]() |
ScanSingleEdge | Very fast detection of an object (e.g. horizontal displacement of a bottle) and simple measurements (e.g. liquid level in a bottle). |
![]() |
SegmentCenter | Computes the center point of a segment. |
Further Readings
- 1D Edge Detection - The article explaining how edge detection filters work.
- Local Coordinate Systems - This article describes basic concept of using the coordinate systems.
- Template Matching - Most detailed description of the Template Matching technique.