Traffic Intersection Analysis
This function block helps you count and log vehicle movements through defined areas of an intersection. It converts tracked detections and polygonal areas into route statistics (for example, "1-2" means a vehicle moved from area 1 into area 2). Designed for easy integration into an inspection scenario, it outputs summarized tracking data ready for export or display.
π₯ Inputs (sockets)
Rectangle - ID Listβ Provide tracked detections (bounding rectangles with tracking IDs).Polygon Areasβ Provide one or more polygon areas that define the intersection zones to monitor.Reset Tracking Logβ Boolean input to clear all stored tracking history and counts.
π€ Outputs (sockets)
Tracking Dataβ Aggregated route counts (JSON-like format) showing how many vehicles of each type passed between area pairs (e.g., "1-2": {"car": 3, "bus": 1}).
πΉοΈ Controls
Reset Tracking Logβ Trigger this input (for example with a manual switch) to reset all counters and internal history.(Polygon areas are provided via the
Polygon Areassocket; use a polygon selection block to define them.)
π― Key Features
Uses tracked bounding boxes and tracking IDs to associate detections across frames and detect area transitions.
Keeps a short recent position history per tracked object to stabilize noisy positions before deciding which polygon area an object occupies.
Produces route-based statistics (area-to-area transitions) grouped by vehicle type.
Supports multiple polygon areas (each area may have many corner points).
Reset option to clear history and counters on demand.
βοΈ Running mechanism (high level)
The block accepts a list of tracked rectangles with IDs and (optionally) vehicle class names.
For each tracked item it computes a representative point (bottom-center of the bounding box) and maintains a short history of recent points for that ID.
The representative point (averaged over recent positions) is tested against each supplied polygon area to determine the current area for that vehicle.
When a vehicleβs area changes (e.g., from area 1 to area 2), the transition is recorded and the corresponding route counter for that vehicle type is incremented.
The aggregated route counts are output as structured data via the
Tracking Datasocket.Activating the
Reset Tracking Loginput clears all stored histories and counters.
π Usage instructions
Provide tracked detections to the
Rectangle - ID Listinput. Use a tracker that outputs rectangles with stable IDs.Define intersection regions with polygons and connect them to the
Polygon Areasinput.To clear counters and history at any time, send a TRUE signal to the
Reset Tracking Loginput.Read the live route statistics from the
Tracking Dataoutput and use them for display, logging or export.
π‘ Tips and Tricks
Use
Object_Detection_Trackerto produce theRectangle - ID Listinput. This block provides tracked rectangles and IDs that are ideal for route analysis.Draw and save polygon areas with
Image ROI Polygon Multiand connect itsPolygonsoutput to the blockβsPolygon Areasinput. That block makes it easy to define multiple intersection zones visually.Use
Logic Inputto provide a manual trigger forReset Tracking Logwhen you want to restart counting at known intervals (shift changes, test runs, etc.).For visual verification, connect detections to
Draw Detectionsto overlay rectangles/IDs on the video, then send the resulting image toShow Imageto preview results live.Export summarized results for reporting with
Data to JSONorCSV Exportusing theTracking Dataoutput.If detections are noisy, consider placing a short smoothing pipeline before tracking (for example, ensure the tracker input image is preprocessed with mild denoising filters) so tracked IDs remain stable.
π οΈ Troubleshooting
No transitions recorded: verify that the
Rectangle - ID Listcontains stable tracking IDs across frames (unstable IDs prevent detecting area changes).Incorrect area assignment: confirm polygon coordinates align with the camera view; use
Image ROI Polygon Multito redraw polygons on the actual image.Counters not clearing: ensure the
Reset Tracking Loginput is receiving a TRUE signal (e.g., from aLogic Inputor other control block).Missing vehicle type labels: route counts are grouped by vehicle type when that metadata is provided; ensure your tracker outputs class/type along with IDs.
Last updated
Was this helpful?