Perspective Correction¶
Class: PerspectiveCorrectionBlockV1
The PerspectiveCorrectionBlock is a transformer block designed to correct
coordinates of detections based on transformation defined by two polygons.
This block is best suited when produced coordinates should be considered as if camera
was placed directly above the scene and was not introducing distortions.
Type identifier¶
Use the following identifier in step "type" field: roboflow_core/perspective_correction@v1to add the block as
as step in your workflow.
Properties¶
| Name | Type | Description | Refs |
|---|---|---|---|
name |
str |
Enter a unique identifier for this step.. | ❌ |
perspective_polygons |
List[Any] |
Perspective polygons (for each batch at least one must be consisting of 4 vertices). | ✅ |
transformed_rect_width |
int |
Transformed rect width. | ✅ |
transformed_rect_height |
int |
Transformed rect height. | ✅ |
extend_perspective_polygon_by_detections_anchor |
str |
If set, perspective polygons will be extended to contain all bounding boxes. Allowed values: CENTER, CENTER_LEFT, CENTER_RIGHT, TOP_CENTER, TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT, CENTER_OF_MASS and ALL to extend to contain whole bounding box. | ✅ |
warp_image |
bool |
If set to True, image will be warped into transformed rect. | ✅ |
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 Perspective Correction in version v1.
- inputs:
LMM,Background Color Visualization,Stitch Images,Image Slicer,Dynamic Zone,Size Measurement,Detections Transformation,Corner Visualization,Model Monitoring Inference Aggregator,Detections Classes Replacement,VLM as Classifier,Identify Outliers,Camera Calibration,Object Detection Model,Mask Visualization,Line Counter,Local File Sink,Model Comparison Visualization,Email Notification,Pixelate Visualization,Time in Zone,Relative Static Crop,Anthropic Claude,Google Gemini,Florence-2 Model,Multi-Label Classification Model,Ellipse Visualization,Triangle Visualization,Segment Anything 2 Model,Camera Focus,OCR Model,QR Code Generator,Byte Tracker,Label Visualization,Time in Zone,Pixel Color Count,Roboflow Custom Metadata,Florence-2 Model,LMM For Classification,Identify Changes,Blur Visualization,Dot Visualization,Overlap Filter,Detection Offset,Stability AI Image Generation,Perspective Correction,Google Vision OCR,EasyOCR,Llama 3.2 Vision,Line Counter,Detections Stabilizer,Absolute Static Crop,SAM 3,Slack Notification,Morphological Transformation,Velocity,Image Blur,Image Threshold,Clip Comparison,Stitch OCR Detections,Byte Tracker,Depth Estimation,Stability AI Outpainting,Halo Visualization,Stability AI Inpainting,Polygon Visualization,OpenAI,Grid Visualization,Roboflow Dataset Upload,Path Deviation,Template Matching,Distance Measurement,Trace Visualization,Classification Label Visualization,CogVLM,Email Notification,VLM as Detector,Instance Segmentation Model,Bounding Box Visualization,Byte Tracker,Image Convert Grayscale,Polygon Zone Visualization,OpenAI,Clip Comparison,Detections Stitch,Keypoint Detection Model,Object Detection Model,Crop Visualization,Image Slicer,YOLO-World Model,Detections Merge,Moondream2,Seg Preview,Icon Visualization,Color Visualization,Path Deviation,Dimension Collapse,Roboflow Dataset Upload,JSON Parser,Keypoint Visualization,Contrast Equalization,Buffer,Image Contours,Instance Segmentation Model,Detections Filter,Circle Visualization,OpenAI,VLM as Classifier,Bounding Rectangle,CSV Formatter,Time in Zone,Detections Combine,Reference Path Visualization,SIFT Comparison,Twilio SMS Notification,VLM as Detector,Webhook Sink,Detections Consensus,Single-Label Classification Model,SIFT,Line Counter Visualization,PTZ Tracking (ONVIF).md),Image Preprocessing,Dynamic Crop,SIFT Comparison - outputs:
Background Color Visualization,Stitch Images,Size Measurement,Image Slicer,VLM as Classifier,Detections Transformation,Corner Visualization,Identify Outliers,Mask Visualization,CLIP Embedding Model,Line Counter,Barcode Detection,Model Comparison Visualization,Email Notification,Time in Zone,Florence-2 Model,Multi-Label Classification Model,Ellipse Visualization,Camera Focus,OCR Model,Label Visualization,SmolVLM2,LMM For Classification,Blur Visualization,Dot Visualization,Perspective Correction,Google Vision OCR,Line Counter,Llama 3.2 Vision,Detections Stabilizer,Slack Notification,Image Blur,Stitch OCR Detections,Depth Estimation,Stability AI Outpainting,Halo Visualization,Qwen2.5-VL,Stability AI Inpainting,CogVLM,Classification Label Visualization,VLM as Detector,Instance Segmentation Model,Byte Tracker,Image Convert Grayscale,Perception Encoder Embedding Model,Polygon Zone Visualization,Clip Comparison,Detections Stitch,Crop Visualization,Image Slicer,YOLO-World Model,Detections Merge,Multi-Label Classification Model,Icon Visualization,Seg Preview,Color Visualization,Path Deviation,Buffer,Circle Visualization,Bounding Rectangle,Time in Zone,SIFT Comparison,Single-Label Classification Model,SIFT,Line Counter Visualization,PTZ Tracking (ONVIF).md),Image Preprocessing,Trace Visualization,SIFT Comparison,LMM,Dynamic Zone,Model Monitoring Inference Aggregator,Detections Classes Replacement,Camera Calibration,Object Detection Model,QR Code Detection,Keypoint Detection Model,Pixelate Visualization,Anthropic Claude,Relative Static Crop,Google Gemini,Triangle Visualization,Segment Anything 2 Model,QR Code Generator,Byte Tracker,Dominant Color,Time in Zone,Pixel Color Count,Roboflow Custom Metadata,Florence-2 Model,Identify Changes,Single-Label Classification Model,Overlap Filter,Detection Offset,Stability AI Image Generation,EasyOCR,Absolute Static Crop,SAM 3,Morphological Transformation,Velocity,Clip Comparison,Image Threshold,Byte Tracker,Polygon Visualization,OpenAI,Grid Visualization,Roboflow Dataset Upload,Path Deviation,Distance Measurement,Template Matching,Email Notification,Bounding Box Visualization,OpenAI,Keypoint Detection Model,Object Detection Model,Gaze Detection,Moondream2,Roboflow Dataset Upload,Keypoint Visualization,Contrast Equalization,Image Contours,Instance Segmentation Model,Detections Filter,OpenAI,VLM as Classifier,Detections Combine,Reference Path Visualization,Twilio SMS Notification,VLM as Detector,Webhook Sink,Detections Consensus,Dynamic Crop
Input and Output Bindings¶
The available connections depend on its binding kinds. Check what binding kinds
Perspective Correction in version v1 has.
Bindings
-
input
predictions(Union[instance_segmentation_prediction,object_detection_prediction]): Predictions.images(image): The input image for this step..perspective_polygons(list_of_values): Perspective polygons (for each batch at least one must be consisting of 4 vertices).transformed_rect_width(integer): Transformed rect width.transformed_rect_height(integer): Transformed rect height.extend_perspective_polygon_by_detections_anchor(string): If set, perspective polygons will be extended to contain all bounding boxes. Allowed values: CENTER, CENTER_LEFT, CENTER_RIGHT, TOP_CENTER, TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT, CENTER_OF_MASS and ALL to extend to contain whole bounding box.warp_image(boolean): If set to True, image will be warped into transformed rect.
-
output
corrected_coordinates(Union[object_detection_prediction,instance_segmentation_prediction]): Prediction with detected bounding boxes in form of sv.Detections(...) object ifobject_detection_predictionor Prediction with detected bounding boxes and segmentation masks in form of sv.Detections(...) object ifinstance_segmentation_prediction.warped_image(image): Image in workflows.extended_transformed_rect_width(integer): Integer value.extended_transformed_rect_height(integer): Integer value.
Example JSON definition of step Perspective Correction in version v1
{
"name": "<your_step_name_here>",
"type": "roboflow_core/perspective_correction@v1",
"predictions": "$steps.object_detection_model.predictions",
"images": "$inputs.image",
"perspective_polygons": "$steps.perspective_wrap.zones",
"transformed_rect_width": 1000,
"transformed_rect_height": 1000,
"extend_perspective_polygon_by_detections_anchor": "CENTER",
"warp_image": false
}