You are here: Start » Program Examples » Parallel Enumeration

Parallel Enumeration


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.


An image of bottles. The position of the bottles may change both in relation to the camera as well as other bottles.


An image with the result of the inspections drawn. If a defect is detected, a rectangle is drawn around it.


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 (AVS)

  1. Load the program from the Bottle Inspection example.

  2. From the Project Explorer window create a new Worker Task Macrofilter named ImageEnumerator.

  3. From the Project Explorer window create a new ImageToInspect queue with Image data type.

  4. Go to the ImageEnumerator Worker Task Macrofilter and in the ACQUIRE section add the EnumerateImages filter.

  5. Provide a proper path to the images in the inDirectory input.

  6. In the PROCESS section add the Queue_Push filter and assign the ImageToInspect queue to it.

  7. Connect the outImage output from the EnumerateImages filter to the inValue input of the Queue_Push filter.

  8. Go back to the Main program.

  9. In the ACQUIRE section add the Queue_Pop filter and assign the ImageToInspect queue to it.

  10. Replace the connection from the outImage output with connection from the outValue output of the Queue_Pop filter.

  11. Remove or disable the EnumerateImages filter in Main.

  12. Add the Loop filter in the ACQUIRE section.

  13. 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
EnumerateImages Emulates image acquisition with images stored on disk.
CreateRectangle Creates a rectangle from an aligned point.
CreateCoordinateSystemFromPoint Most often used to define an object alignment from results of 1D Edge Detection or Blob Analysis.
SegmentCenter Computes the center point of a segment.
ScanMultipleStripes Very fast detection of multiple pairs of opposite edges - usually for counting or width measurements.
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.
Loop Put this filter into a task that should have a loop, but does not have any other loop generators (e.g. GrabImage).
LocateSingleObject_Edges1 Detection of an object whose outlines are sharp and rigid. Often one of the first filters in a program.
ScanSingleEdge Very fast detection of an object (e.g. horizontal displacement of a bottle) and simple measurements (e.g. liquid level in a bottle).

Further Readings