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:
Detections Consensus,Path Deviation,Llama 3.2 Vision,Cosine Similarity,SAM 3,Perspective Correction,Velocity,Roboflow Custom Metadata,Detections Transformation,Segment Anything 2 Model,Dynamic Crop,Dynamic Zone,LMM,OpenAI,Florence-2 Model,Single-Label Classification Model,SAM 3,Time in Zone,Moondream2,Google Gemini,Florence-2 Model,LMM For Classification,Time in Zone,Object Detection Model,OCR Model,Anthropic Claude,Google Vision OCR,VLM as Detector,Local File Sink,EasyOCR,Line Counter,VLM as Detector,Email Notification,Detections Combine,Detections Filter,Byte Tracker,Overlap Filter,Roboflow Dataset Upload,Slack Notification,Keypoint Detection Model,Gaze Detection,Object Detection Model,Detections Stabilizer,Google Gemini,Model Monitoring Inference Aggregator,Roboflow Dataset Upload,Multi-Label Classification Model,Detections Merge,Twilio SMS Notification,Byte Tracker,Instance Segmentation Model,Seg Preview,VLM as Classifier,CSV Formatter,Motion Detection,OpenAI,Byte Tracker,Webhook Sink,PTZ Tracking (ONVIF).md),Detections Classes Replacement,Instance Segmentation Model,Detections Stitch,YOLO-World Model,Camera Focus,Stitch OCR Detections,CogVLM,Clip Comparison,Identify Changes,Template Matching,Path Deviation,Email Notification,OpenAI,Bounding Rectangle,SAM 3,Anthropic Claude,Time in Zone,Detection Offset,OpenAI - outputs:
Detections Consensus,Blur Visualization,Perspective Correction,Bounding Box Visualization,QR Code Generator,Pixelate Visualization,Trace Visualization,Image Threshold,Polygon Visualization,Icon Visualization,Image Slicer,Identify Outliers,Stability AI Outpainting,Dynamic Zone,Classification Label Visualization,Stitch Images,Mask Visualization,SIFT Comparison,Absolute Static Crop,Circle Visualization,Ellipse Visualization,Object Detection Model,Image Preprocessing,Anthropic Claude,Color Visualization,Image Blur,Keypoint Visualization,Keypoint Detection Model,Email Notification,Image Slicer,Byte Tracker,Triangle Visualization,Slack Notification,Keypoint Detection Model,Object Detection Model,Halo Visualization,Detections Stabilizer,Corner Visualization,Dot Visualization,Image Contours,Twilio SMS Notification,Byte Tracker,Instance Segmentation Model,Reference Path Visualization,Motion Detection,Morphological Transformation,Byte Tracker,Webhook Sink,PTZ Tracking (ONVIF).md),Detections Classes Replacement,Instance Segmentation Model,Stitch OCR Detections,Stability AI Inpainting,Line Counter Visualization,Identify Changes,Email Notification,Crop Visualization,Grid Visualization,Background Subtraction,Pixel Color Count,Anthropic Claude,Label Visualization,Detection Offset,SIFT Comparison,Dominant Color
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[instance_segmentation_prediction,object_detection_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
}