Distance Measurement¶
Class: DistanceMeasurementBlockV1
Source: inference.core.workflows.core_steps.classical_cv.distance_measurement.v1.DistanceMeasurementBlockV1
Calculate the distance between two bounding boxes on a 2D plane, leveraging a perpendicular camera view and either a reference object or a pixel-to-unit scaling ratio for precise measurements.
Type identifier¶
Use the following identifier in step "type" field: roboflow_core/distance_measurement@v1to add the block as
as step in your workflow.
Properties¶
| Name | Type | Description | Refs |
|---|---|---|---|
name |
str |
Enter a unique identifier for this step.. | ❌ |
object_1_class_name |
str |
The class name of the first object.. | ❌ |
object_2_class_name |
str |
The class name of the second object.. | ❌ |
reference_axis |
str |
The axis along which the distance will be measured.. | ❌ |
calibration_method |
str |
Select how to calibrate the measurement of distance between objects.. | ❌ |
reference_object_class_name |
str |
The class name of the reference object.. | ✅ |
reference_width |
float |
Width of the reference object in centimeters. | ✅ |
reference_height |
float |
Height of the reference object in centimeters. | ✅ |
pixel_ratio |
float |
The pixel-to-centimeter ratio of the input image, i.e. 1 centimeter = 100 pixels.. | ✅ |
The Refs column marks possibility to parametrise the property with dynamic values available
in workflow runtime. See Bindings for more info.
Available Connections¶
Compatible Blocks
Check what blocks you can connect to Distance Measurement in version v1.
- inputs:
Template Matching,OpenAI,Line Counter,VLM as Detector,Path Deviation,Time in Zone,Byte Tracker,Velocity,Instance Segmentation Model,Object Detection Model,Detections Stabilizer,Model Monitoring Inference Aggregator,Llama 3.2 Vision,LMM For Classification,Bounding Rectangle,Google Vision OCR,Local File Sink,Time in Zone,Slack Notification,Seg Preview,Instance Segmentation Model,Clip Comparison,VLM as Detector,Object Detection Model,Overlap Filter,OCR Model,Moondream2,CSV Formatter,Dynamic Zone,Twilio SMS Notification,VLM as Classifier,Cosine Similarity,Identify Changes,Segment Anything 2 Model,Webhook Sink,Dynamic Crop,Detections Consensus,Byte Tracker,Detections Classes Replacement,Email Notification,Gaze Detection,Detections Combine,OpenAI,Single-Label Classification Model,Detection Offset,Time in Zone,Camera Focus,Detections Filter,Roboflow Custom Metadata,CogVLM,Detections Merge,YOLO-World Model,OpenAI,Florence-2 Model,Detections Transformation,Roboflow Dataset Upload,Google Gemini,Stitch OCR Detections,Perspective Correction,Keypoint Detection Model,Path Deviation,EasyOCR,Anthropic Claude,PTZ Tracking (ONVIF).md),Multi-Label Classification Model,LMM,Roboflow Dataset Upload,Detections Stitch,Florence-2 Model,Byte Tracker - outputs:
Absolute Static Crop,Keypoint Visualization,Byte Tracker,Object Detection Model,Slack Notification,Trace Visualization,Color Visualization,Instance Segmentation Model,Halo Visualization,Identify Changes,Dynamic Zone,Triangle Visualization,Stability AI Inpainting,Image Threshold,Reference Path Visualization,Corner Visualization,Detections Classes Replacement,Ellipse Visualization,Detection Offset,Morphological Transformation,Grid Visualization,Image Preprocessing,Line Counter Visualization,SIFT Comparison,Stitch OCR Detections,Label Visualization,PTZ Tracking (ONVIF).md),Polygon Visualization,Instance Segmentation Model,Detections Stabilizer,Icon Visualization,Blur Visualization,Image Contours,Identify Outliers,Object Detection Model,Twilio SMS Notification,Bounding Box Visualization,Classification Label Visualization,Webhook Sink,Dot Visualization,Dominant Color,Pixelate Visualization,Byte Tracker,Detections Consensus,Email Notification,Image Slicer,Stitch Images,Crop Visualization,Keypoint Detection Model,Mask Visualization,SIFT Comparison,Pixel Color Count,QR Code Generator,Image Slicer,Perspective Correction,Keypoint Detection Model,Anthropic Claude,Image Blur,Circle Visualization,Stability AI Outpainting,Byte Tracker
Input and Output Bindings¶
The available connections depend on its binding kinds. Check what binding kinds
Distance Measurement in version v1 has.
Bindings
-
input
predictions(Union[object_detection_prediction,instance_segmentation_prediction]): The output of a detection model describing the bounding boxes that will be used to measure the objects..reference_object_class_name(string): The class name of the reference object..reference_width(float): Width of the reference object in centimeters.reference_height(float): Height of the reference object in centimeters.pixel_ratio(float): The pixel-to-centimeter ratio of the input image, i.e. 1 centimeter = 100 pixels..
-
output
Example JSON definition of step Distance Measurement in version v1
{
"name": "<your_step_name_here>",
"type": "roboflow_core/distance_measurement@v1",
"predictions": "$steps.model.predictions",
"object_1_class_name": "car",
"object_2_class_name": "person",
"reference_axis": "vertical",
"calibration_method": "<block_does_not_provide_example>",
"reference_object_class_name": "reference-object",
"reference_width": 2.5,
"reference_height": 2.5,
"pixel_ratio": 100
}