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.
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.
Provide a proper path to the images in inDirectory input.
In the PROCESS section add Queue_Push filter and assign ImageToInspect queue to it.
Go back to the Main program.
In the ACQUIRE section add Queue_Pop filter and assign ImageToInspect queue to it.
Remove or disable EnumerateImages filter in Main.
Program is ready to use. In the current version, programs using worker tasks can be properly run only in the Run mode (F5)
|EnumerateImages||Emulates image acquisition with images stored on disk.|
|CreateRectangle||Creates a rectangle from an aligned point.|
|LocateSingleObject_Edges||Detection of an object whose outlines are sharp and rigid. Often one of the first filters in a program.|
|ScanMultipleStripes||Very fast detection of multiple pairs of opposite edges - usually for counting or width measurements.|
|CreateCoordinateSystemFromPoint||Most often used to define an object alignment from results of 1D Edge Detection or Blob Analysis.|
|CheckPresence_Intensity||Quick and easy presence verification, e.g. for missing caps, screws, labels.|
|ScanSingleEdge||Very fast detection of an object (e.g. horizontal displacement of a bottle) and simple measurements (e.g. liquid level in a bottle).|
|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.|
|SegmentCenter||Computes the center point of a segment.|
|Loop||Put this filter into a task that should have a loop, but does not have any other loop generators (e.g. GrabImage).|