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