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