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 Matrix for 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

  1. Provide an image source to Image Any (camera stream or loaded image).

  2. If you need real-world distances, supply a calibrated Perspective Matrix. Without it, distance checks use image-plane units.

  3. Set the desired Distance Threshold according to your calibration or approximate pixel distance.

  4. Tune Confidence Ratio to balance missed detections vs false positives.

  5. 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, or Load Image.

  • To preview results in a larger view, add Show Image after this block.

  • If detection is noisy, try resizing or denoising the image beforehand using Image Resizer or Denoising to improve stability.

  • For more robust person detection or custom classes, consider combining with Object Detection or Object Detection - Custom upstream and feed detected centers into this block for distance checking.

  • Use Perspective Transform to produce a reliable Perspective Matrix when you need real-world distances.

  • Use Image ROI or Image ROI Select to limit the analysis area (reduce false detections and speed up processing).

  • When tracking is required across frames, use Object_Detection_Tracker downstream to get persistent IDs and improved analytics.

πŸ› οΈ Troubleshooting

  • No people detected: increase Confidence Ratio slightly or provide higher-resolution input. Ensure the scene lighting allows for clear person outlines.

  • Many false positives: try increasing Confidence Ratio, apply preprocessing like Blur or Image Threshold, or restrict the area with Image ROI.

  • Distance measurements seem incorrect: verify the calibration and provide a correct Perspective Matrix using Perspective 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 Resizer or run detection less frequently.

Last updated

Was this helpful?