Line Counter

The Line Counter module will count objects/blobs within a specified area while keeping tracking of previous blobs to ensure objects are only counted once. This is a common issue within production lines that have multiple products within view of a camera that can proceed at different conveyor speeds or even be stopped momentarily. This module uses object spacing (the distance between object) to keep track of a single object from one image to the next in order to know when it disappears from the camera view (indicating a count).

The module will also accommodate some merging and splitting of objects as long as the most common object size is the size of a single object to be counted.

Functionally similar to the Blob Tracking module, the Line Counter module will track objects only based on relative position to previous blobs. Thus the module assumes that objects are moving at about the same speed and in the same direction. Because of these constraints the Line Counter module does not require as many characteristics as the Blob Tracking module does in order to track objects. This allows for simpler configuration and more reliable operation in production line operation.

The module will count objects as they disappear from view (i.e. leave the specified line coordinates).



1. Current Image - Move the red rectangles to the place you want to track objects. You can move the entire line by dragging the smaller red square in the center or by adjusting the individual corner squares. To fine tune the positioning you can change the coordinates of the overall square using the textboxes below in the Line Coordinates area.

Use SHIFT-drag to create a new Line Area of a certain size in the clicked position. When zoomed in, drag the image around to view different parts of the image or expand the dialog window to view more of the image.

Note the direction of the arrows indicates the flow of objects. This MUST be the only direction objects flow otherwise the Line Counter module will not work correctly.

2. Line Coordinates - To accurately place the line area you can modify its coordinates using the provided numerical coordinates.

3. Label - Use the label text box to specify the name of each line. The label will be used to set the count for each line when using multiple count lines per image.

4. Add / Delete Line Buttons - You can add or remove counting lines by using the appropriate button. Adding a new counting line will create a new area that can be moved to the appropriate location. Having an existing line selected such that its coordinates are visible in the Line Coordinates interface and pressing the Delete button will remove that line from the interface.

5. Reset Counts - Will reset the number of objects counted to zero for ALL counting lines.

6. Reset Tracking - Its possible that during the course of counting objects some may need to be removed (due to quality assurance checks). When this happens, you can reset the tracking which will recount all in view objects as if they suddenly appeared in view. This will compensate for object being remove or added as part of a natural production line without causing the count to be incorrect.

7. Command Variable - In order to automate the resetting you can specify a variable that includes reset (resets counter and restarts tracking), reset_count (resets just the count) or reset_tracking (recounts current objects).

8. Font Size, Font Color, Text Position - Specifies size, color and position of the count text. This is separate from the graphic colors which can be removed by setting the colors to blank.

9. Graphic Color - The color used to show the line counting area, object ids and object vectors.

10. Show Blob IDs - Indicates the object number graphically as the objects move by.

11. Show Blob Vector - Shows the vector that connects a blob from the previous image to the current one.

12. Show Line Label - Shows the label for each line counting area.

13. Max Vector Size - The maximum movement in pixels that an object can move from one image to the next.

14. Min Blob Percent Size - The module will calculate the median size blob given all available blobs within a track and remove those blobs that are much larger or much smaller than the median size. The Min Blob Percent Size allows you to change this cutoff to include blobs of differing size. It is assumed that the Line Counter is counting blobs of similar size which is the reason for this threshold.


Line_X - the count for the particular line assuming no label was used. Otherwise a variable
	with the label name will be created to contain the current line count.
Line_X_Count - the current number of blobs contained with the specified sample area. The
	Line_X variable will NOT include current blobs as they are still present in the
	sample area. Line_X is only increased for blobs that disappear from the sample

See Also

Blob Tracking
Object Tracking

 New Post 

Line_Counter Related Forum PostsLast postPostsViews
How to count objects crossing a line(tripwire)
Hi Steven, I have white buttons moving on a conveyor. Im using a webcam to get the video stream, I ...
3 years 2 1515
Egg counting
Hi, how can we count the chicken eggs on a moving conveyor as attached in the video screenshot? Thanks...
6 years 2 1529