Line Crossing Detection: Virtual Fence & Geofence Alerts
An intrusion rule answers “is there someone in this area”. A line rule answers a sharper question: “did they cross, and which way did they go”. That direction is often the whole value — a person moving from the public pavement into your yard is a very different event from a person leaving it, and a vehicle entering a one-way service road against the flow is an emergency while a vehicle leaving it is just untidy. Line crossing detection turns any line on any camera into a directional tripwire.
What a Virtual Line Actually Is
You draw a line, or a short polyline, across a camera view and assign it a direction mode. The system tracks every classified object in the frame, and when a tracked object’s path intersects the line in a permitted direction, the rule evaluates — object class, current schedule, and minimum dwell inside the associated region if you have set one — and then fires. The output carries the direction, so downstream you can route inbound events to a guard and outbound events to a log.
Because the line is geometry rather than hardware, it can be redrawn in seconds. Sites routinely change boundaries between phases of a construction project, or move a line when a stockpile grows, without touching a single physical device.
Direction Modes and When to Use Them
- Inbound only — the default for boundary protection. Alerts when something enters, ignores everything leaving. Cuts alert volume roughly in half against a bidirectional rule.
- Outbound only — the tailgate-theft and removal case. Someone walking out of a compound through a non-gate boundary, or stock leaving via an unauthorised route.
- Bidirectional — for threshold counting and for areas where any crossing matters, such as a rail-side exclusion zone or a machine guarding line.
- Per-object-direction — people inbound, vehicles outbound, for example at a gate where staff arrive on foot and loads leave by truck.
Where Sites Use It
Construction sites draw lines at hoarding gaps and at the top of unguarded stair cores. Warehouses put them across pedestrian routes that intersect forklift aisles. Utilities use them around substation perimeters and along fence lines shared with public land. Car parks use them at one-way points, which pairs naturally with wrong-way detection for the same geometry.
The most effective deployments use two rules on the same boundary rather than one. A line on the fence gives the direction and the instant of crossing; perimeter intrusion detection on the ground beyond it confirms the object is inside and still there. The line says go, the zone says where.
Safety applications are just as common as security ones. A line drawn across the swing radius of a crane, the approach to a machine, or the edge of a loading dock produces an alert at the moment of entry rather than after the consequence. Guidance on excluding people from hazard zones is standard occupational-safety practice — see OSHA — and the detection itself is ordinary computer vision applied to a defined boundary.
Accuracy: The Four Settings That Matter
Line rules are the easiest to get right and the easiest to leave badly configured.
- Line placement. Draw it across the direction of travel, not along it. A line parallel to the path people walk is nearly useless.
- Object class. Arm for people and vehicles, never for “any motion”. This single setting removes most weather, animal and lighting artefacts.
- Minimum dwell. Require the object to exist on the far side for a second or two. This removes headlight sweeps and anything that merely clips the corner.
- Schedule. Disarm during known legitimate traffic. A line across a gate that staff use every morning will destroy trust in the whole system within a week.
Two failure modes deserve specific attention. Occlusion: if a group crosses together, the tracker may merge them and count one crossing where three occurred — for counting accuracy, use a doorway-framed camera rather than a wide view. And camera movement: a PTZ that patrols invalidates the line as soon as it moves, because the line is defined in the fixed frame. Use preset positions with per-preset lines, or fix the camera.
That last point is why camera displacement detection and camera tampering detection are not optional extras. A line drawn on a camera that has drifted ten degrees is a line in the wrong place, and it will fail silently.
For the on-site view, read perimeter security system.
This is one of the topics we cover in more detail in motorcycle entry detection.
Common Questions
Do I need to install any hardware on the boundary? No. The line is drawn on your existing camera feed through an on-premise appliance — no beams, no posts, no cabling.
Does it work at night? Yes, provided the area has usable IR or ambient lighting. Detection quality follows lighting quality, so lighting is usually the cheapest accuracy investment.
Does it keep running without internet? It does. Inference is entirely on-device, so crossings, relays and local alarms continue; only remote notifications pause.
What does it cost? Far less than any physical detection over the same boundary. Cost scales with channels and the algorithm set, and you can pilot on the two cameras covering your most concerning line.
Draw Your First Line
Pick the boundary where direction would change your response. Tell us your scenario — boundary type, camera count and hours of concern — or start with a Starter Kit and test it on your own footage. Related: warehouse safety systems and overheight vehicle detection.
