Social Distance Detector
This function block analyzes an image stream to detect people and check physical distancing based on a distance threshold. It visualizes detected people and highlights pairs that violate the specified distance.
π₯ Inputs
Image Any Feed the image or video frame to be analyzed.
Perspective Matrix Optional transformation matrix to convert image coordinates to a real-world plane for more accurate distance measurement.
Distance Threshold The minimum allowed distance between people (units depend on perspective calibration).
π€ Outputs
Image Any Annotated image with detected people, connecting lines, and violation highlights.
Person Count Number of people detected in the frame.
Violation Count Number of pairwise violations detected (pairs closer than threshold).
Is Violated ? Boolean indicating whether any violation exists.
πΉοΈ Controls
Confidence Ratio Slider that adjusts detection confidence sensitivity. Higher values require stronger detection confidence to count as a person.
π¨ Features
Real-time person detection and visualization on incoming images.
Pairwise distance measurement between detected people.
Optional perspective correction using a provided
Perspective Matrixfor more accurate real-world distance checks.Clear outputs for monitoring and downstream processing: image, counts, and violation flag.
π Running mechanism
When active, this block receives the image input, detects person positions in the frame, optionally maps those positions using the provided Perspective Matrix, computes pairwise distances, and compares them to the provided Distance Threshold. The block returns an annotated image and numeric/boolean outputs describing detection and violation state.
π How to use
Provide an image source to
Image Any(camera stream or loaded image).If you need real-world distances, supply a calibrated
Perspective Matrix. Without it, distance checks use image-plane units.Set the desired
Distance Thresholdaccording to your calibration or approximate pixel distance.Tune
Confidence Ratioto balance missed detections vs false positives.Read the outputs to trigger alerts, logs, or further processing when violations occur.
π‘ Tips and Tricks
For camera input, pair this block with an image source such as
Camera USB,Camera IP (ONVIF),Stream Reader, orLoad Image.To preview results in a larger view, add
Show Imageafter this block.If detection is noisy, try resizing or denoising the image beforehand using
Image ResizerorDenoisingto improve stability.For more robust person detection or custom classes, consider combining with
Object DetectionorObject Detection - Customupstream and feed detected centers into this block for distance checking.Use
Perspective Transformto produce a reliablePerspective Matrixwhen you need real-world distances.Use
Image ROIorImage ROI Selectto limit the analysis area (reduce false detections and speed up processing).When tracking is required across frames, use
Object_Detection_Trackerdownstream to get persistent IDs and improved analytics.
π οΈ Troubleshooting
No people detected: increase
Confidence Ratioslightly or provide higher-resolution input. Ensure the scene lighting allows for clear person outlines.Many false positives: try increasing
Confidence Ratio, apply preprocessing likeBlurorImage Threshold, or restrict the area withImage ROI.Distance measurements seem incorrect: verify the calibration and provide a correct
Perspective MatrixusingPerspective Transform. Without perspective correction, distances are in image pixels and may not reflect real-world values.High CPU/GPU load: reduce input resolution with
Image Resizeror run detection less frequently.
Last updated
Was this helpful?