How to implement tripwire in C#

The tripwire in the Ozeki Camera SDK will help you to identify user-defined objects that move in a specified direction as they cross a line (a tripwire) drawn within the camera's field of view.

What does tripwire mean?

tripwire moving objects
Figure 1 - Tripwire moving objects

In our example let's image the security system of a warehouse. The owner would like to ensure that noone is locked in the building after closing. He has a camera in opposite to the entrance and he wishes to use only this camera. The solution is to count the people who travelling from the top towards the bottom of the frame as IN if and only if they pass over a line and count a people travelling from the bottom towards the top as OUT, again, only if they pass over the line. Some blobs (in this case the staff which has it's own entrance) only move under the camera and never enter or exit the store through the main door. These are in most cases not to be counted.

The application also retains the track described by a blob in order to identify each unique blob across successive frames. If we were to count people going through a large entrance at the top of the image, knowing the path of the blobs will show that the middle blob can be counted as entering, the rightmost blob as exiting and the leftmost blob should not be counted. Analyzing the path of the blobs is the goal of blob tracking.

The results also showed that segmentation can be the most difficult stage in blob detection because it's success depends on the quality and brightness of the image generated by the illumination conditions.

Multiline tripwire

Tripwires can be used to protect boundaries such as railway tracks, freeways and building perimeters. The operator will be informed when a tripwire is crossed. Tripwires can be used to count how many people enter and leave buildings at different points. Up to two tripwires can be placed in the scene and combined with different situation handlers e.g. an alarm only if both tripwires are crossed.

how to determine the direction of obejcts
Figure 2 - Determine the direction of the objects

Multiline tripwire detection identifies objects that cross two defined lines and generates an event based on defined parameters, including directionality. For example there are several situations where only one way of the directions is allowed. In this case, you can check which line was crossed first to determine the direction of the object.

how to measure elapsed time before crossing  secong tripwire
Figure 3 - Measure elapsed time before crossing second tripwire

Defined parameters for this behavior include direction, sequential order, and time between crossing each tripwire. So you can measure the elapsed time of each object before crossing the second tripwire. This is really useful in sport events or when it comes to analyze the popularity of a side shop.

Related Pages


Below you can find the answers for the most frequently asked questions related to this topic:

  1. How can I get the URL of the camera?

    You can get the URL from the producer of the camera. (In the 10th tutorial you can find information on how to create your own IP camera discoverer program.)

More information