Skip to content

Blob Analysis 1D#

The Blob Analysis 1D example illustrates the use of the 1D blob operator in a VisualApplets environment.

The 1D Blob Analysis example is a simple applet based on a base line camera. The camera is used with a line trigger only. Hence, the applet is based on real 1D images. For DMA transmission, the original image is transformed into small pieces of successive lines forming a 2D image. All parts of the applet will be explained in detail in the following. Figure 1 shows the main sheet of the design.

Figure 1: Blob Analysis 1D Design

For acquisition, a line camera operator connected to an ImageBuffer is used. This buffer allows the buffering of 1D image lines. Next, in the Hierarchical Box Binarize a simple thresholding is performed to convert the pixels into foreground and background pixels. A selector allows switching the original image and the binary image to the image output path. This is simply done by an IF operator and a CONST operator. The dynamic parameter of the CONST operator allows the modification of the IF operator's condition input to switch its inputs. Hence, during runtime it is possible to switch between the original grayscale image and the binarized image.

Figure 2: Switching Between Grayscale and Binary Image

As the applet's application purpose will be the visualization of the objects found in the original image it is required to allow a synchronization of both DMA channels in the PC. A line marker is used to mark every line of the original image and every blob. Hence a counter is used to count every line. The line counter is contained in the Hierarchical Box 1DBlobAnalysis together with the blob analysis operator and the line count value leaves the box through the upper link O000. The counter has a range of 10 bits. Hence, an overflow occurs at value 1024 and the counter starts from zero again.

In ReplaceFirstPixelByLineNo the first four pixels of a line are replaced by the line count. For that purpose the parallelism is changed so operation is done at a granularity of 32 bit. The x-coordinate is count and every time the x-coordinate is zero, the line number (expanded to 32 bit) is forwarded instead of the original pixel values.

Figure 3: Replacing of Leading Pixels by Line Number

Beside the line marker it is required generating a flush condition for the Blob Analysis operation. The flush may be implemented as a trigger input or in this case, a flush condition is produced once every line. Hence, the Blob Analysis will finalize (Eof) its output once a line. However, the Blob Analysis is configured to this behavior only if the output frame is not empty by using parameter supres_empty_output_frames. Furthermore, the Blob Analysis is configured to a maximum object height of 10 bits i.e., 1024 pixels. The maximum output frame size of the operator is set to 20. If more objects have to be output and no flush condition occurs, the operator will generate a new frame. These small output frames allow a minimization of the time the object has been detected and the time it can be analyzed in the PC.

Figure 4: Line Counting And Blob Analysis
Figure 5: The Blob 1D Example Configuration Parameters

The 11 Blob Analysis output streams are merged into one stream which is connected to the DMA. This is simply done using MergePixel and InsertPixel operators. The order of the object features is shown in the table below.

Figure 6: The Merging of the Blob Streams into One Link for Blob1D Applet
Byte No. Object Feature
0 to 3 Line Marker
4 to 5 Bounding Box X0
6 to 7 Bounding Box X1
8 to 11 Center of Gravity Y
12 to 15 Center of Gravity Y
16 to 17 Bounding Box Y0
18 to 19 Bounding Box Y1
20 to 23 Area
24 to 25 Contour Length Diagonal
26 to 27 Contour Length Orthogonal
28 to 31 Error Flags

The run of this project in hardware requires a special hardware setup with line camera and trigger encoder system. The design file can be found in folder Examples\Processing\BlobAnalysis\Blob1D in the Visual Applets installation path. A complex SDK project is added to the design which mostly demonstrates the displaying of objects.

Back to top