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