Relative Static Crop¶
Class: RelativeStaticCropBlockV1
Extract a fixed rectangular region from input images using relative coordinates (normalized 0.0-1.0 values proportional to image dimensions) specified by center point and dimensions, creating consistent proportional crops from the same relative location across images of different sizes for region-of-interest extraction and size-agnostic fixed-area analysis workflows.
How This Block Works¶
This block crops a fixed rectangular region from input images using relative coordinates (normalized 0.0-1.0 values), unlike absolute static cropping which uses pixel coordinates. The relative coordinates adapt to different image sizes, making it ideal for extracting the same proportional region from images of varying dimensions. The block:
- Receives input images and relative coordinate specifications (x_center, y_center, width, height) as values between 0.0 and 1.0
- Converts relative coordinates to absolute pixel coordinates by multiplying with image dimensions:
- Converts x_center from relative (0.0-1.0) to absolute pixels:
x_center_pixels = image_width * x_center - Converts y_center from relative (0.0-1.0) to absolute pixels:
y_center_pixels = image_height * y_center - Converts width from relative (0.0-1.0) to absolute pixels:
width_pixels = image_width * width - Converts height from relative (0.0-1.0) to absolute pixels:
height_pixels = image_height * height - Calculates the crop boundaries from the converted center point and dimensions:
- Computes x_min and y_min by subtracting half the width/height from the center coordinates
- Computes x_max and y_max by adding the width/height to the minimum coordinates
- Rounds coordinate values to integer pixel positions
- Extracts the rectangular region from the image using array slicing (from y_min to y_max, x_min to x_max)
- Validates that the cropped region has content (returns None if the crop would be empty, such as when coordinates are outside image bounds)
- Creates a cropped image object with metadata tracking the crop's origin (original image, offset coordinates, unique crop identifier)
- Preserves video metadata if the input is from video (maintains frame information and temporal context)
- Returns the cropped image for each input image
The block uses relative coordinates (0.0-1.0), so the same proportional region is extracted from all images regardless of their size. For example, x_center=0.5, y_center=0.5, width=0.4, height=0.4 extracts a 40% by 40% region centered in the image, whether the image is 100x100 pixels or 2000x2000 pixels. This makes the block particularly useful for extracting consistent regions from images of varying sizes (e.g., always cropping the top-right 20% corner, extracting a fixed percentage of the image center, or focusing on a specific proportional area). The center-based coordinate system allows specifying crops by their center point rather than corner coordinates, which can be more intuitive for defining proportional regions.
Common Use Cases¶
- Size-Agnostic Region Extraction: Extract the same proportional region from images of different sizes for consistent analysis (e.g., crop the top-right 20% corner from images regardless of resolution, extract a fixed percentage of the image center, crop a consistent proportional area for pattern matching), enabling standardized region analysis across images with varying dimensions
- Multi-Resolution Image Processing: Extract consistent proportional regions from images with different resolutions (e.g., crop the same relative area from high-resolution and low-resolution images, extract proportional regions from resized images, maintain consistent cropping across different image sizes), enabling size-independent region extraction
- Proportional Region-of-Interest Focus: Isolate specific proportional areas of images for detailed processing (e.g., crop a specific relative quadrant of images, extract a fixed percentage region for text recognition, focus on a known proportional area of interest), enabling focused analysis of predetermined proportional regions
- Multi-Stage Workflow Preparation: Extract fixed proportional regions for secondary processing steps (e.g., crop a specific relative area from full images, then run OCR or classification on the cropped region), enabling hierarchical workflows with proportional region focus
- Standardized Crop Generation: Create consistent proportional crops from images for training or analysis (e.g., extract a fixed relative region from all images for dataset creation, crop a standard proportional area for comparison, generate uniform proportional crops for feature extraction), enabling standardized data preparation workflows across varying image sizes
- Video Frame Proportional Cropping: Extract the same proportional region from video frames of different resolutions (e.g., crop a fixed percentage area from each video frame for temporal analysis, extract a consistent proportional monitoring zone for tracking, focus on a specific relative region across frames), enabling temporal analysis of proportional regions across varying frame sizes
Connecting to Other Blocks¶
This block receives images and produces cropped images from fixed proportional regions:
- After image loading blocks to extract a fixed proportional region of interest before processing, enabling focused analysis of predetermined image areas without processing entire images, particularly useful when working with images of varying sizes
- Before classification or analysis blocks that need region-focused inputs (e.g., OCR for text in a fixed proportional area, fine-grained classification for cropped regions, specialized models for specific proportional image areas), enabling optimized processing of consistent proportional regions
- In video processing workflows to extract the same proportional region from multiple frames regardless of resolution changes (e.g., crop a fixed percentage area from each video frame for temporal analysis, extract a consistent proportional monitoring zone for tracking, focus on a specific relative region across frames), enabling temporal analysis of proportional regions
- After detection blocks where you know the approximate relative location and want to extract a fixed-size proportional region around it (e.g., detect objects in a general relative area, then crop a fixed proportional region around that area for detailed analysis), enabling region-focused multi-stage workflows with size-agnostic cropping
- Before visualization blocks that display specific regions (e.g., display only the cropped proportional region, visualize a fixed relative area of interest, show isolated region annotations), enabling focused visualization of extracted proportional regions
- In batch processing workflows where the same proportional region needs to be extracted from all images for consistent analysis or comparison, regardless of individual image sizes, enabling standardized proportional region extraction across image sets with varying dimensions
Type identifier¶
Use the following identifier in step "type" field: roboflow_core/relative_statoic_crop@v1to add the block as
as step in your workflow.
Properties¶
| Name | Type | Description | Refs |
|---|---|---|---|
name |
str |
Enter a unique identifier for this step.. | ❌ |
x_center |
float |
X coordinate of the center point of the crop region as a relative value (0.0 to 1.0). 0.0 represents the left edge of the image, 1.0 represents the right edge, and 0.5 represents the center horizontally. The crop region is centered at this X coordinate after converting to absolute pixels. The actual crop boundaries are calculated as x_min = x_center - width/2 and x_max = x_min + width, where all values are converted to pixels based on image width. If the calculated crop extends beyond image bounds, the crop will be clipped or may return None if the crop would be empty. Relative coordinates adapt to different image sizes - the same relative value extracts the same proportional position from images of any size.. | ✅ |
y_center |
float |
Y coordinate of the center point of the crop region as a relative value (0.0 to 1.0). 0.0 represents the top edge of the image, 1.0 represents the bottom edge, and 0.5 represents the center vertically. The crop region is centered at this Y coordinate after converting to absolute pixels. The actual crop boundaries are calculated as y_min = y_center - height/2 and y_max = y_min + height, where all values are converted to pixels based on image height. If the calculated crop extends beyond image bounds, the crop will be clipped or may return None if the crop would be empty. Relative coordinates adapt to different image sizes - the same relative value extracts the same proportional position from images of any size.. | ✅ |
width |
float |
Width of the crop region as a relative value (0.0 to 1.0). 1.0 represents 100% of the image width, 0.5 represents 50% of the image width, etc. Defines the horizontal extent of the crop as a proportion of the image width. The crop extends width/2 pixels to the left and right of the x_center coordinate after converting to absolute pixels. Total crop width equals this relative value multiplied by the image width. If the calculated crop extends beyond the image's width, it will be clipped to image boundaries. Relative width adapts to different image sizes - the same relative value extracts the same proportional width from images of any size.. | ✅ |
height |
float |
Height of the crop region as a relative value (0.0 to 1.0). 1.0 represents 100% of the image height, 0.5 represents 50% of the image height, etc. Defines the vertical extent of the crop as a proportion of the image height. The crop extends height/2 pixels above and below the y_center coordinate after converting to absolute pixels. Total crop height equals this relative value multiplied by the image height. If the calculated crop extends beyond the image's height, it will be clipped to image boundaries. Relative height adapts to different image sizes - the same relative value extracts the same proportional height from images of any size.. | ✅ |
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 Relative Static Crop in version v1.
- inputs:
Perspective Correction,Stability AI Inpainting,Image Convert Grayscale,Clip Comparison,Morphological Transformation,Pixelate Visualization,Stitch Images,QR Code Generator,Image Slicer,Image Preprocessing,SIFT,Line Counter Visualization,Polygon Zone Visualization,Image Threshold,Image Slicer,Corner Visualization,Dynamic Crop,Stability AI Outpainting,Detections Consensus,Halo Visualization,Heatmap Visualization,Keypoint Visualization,Color Visualization,Blur Visualization,Stability AI Image Generation,Camera Focus,Label Visualization,Classification Label Visualization,Camera Focus,Camera Calibration,Morphological Transformation,Trace Visualization,Contrast Enhancement,Identify Outliers,Bounding Box Visualization,Reference Path Visualization,Depth Estimation,Halo Visualization,Ellipse Visualization,Model Comparison Visualization,Dot Visualization,Identify Changes,SIFT Comparison,Image Contours,Mask Visualization,Relative Static Crop,Crop Visualization,Background Subtraction,Circle Visualization,Text Display,Polygon Visualization,Background Color Visualization,Absolute Static Crop,Image Blur,Polygon Visualization,Contrast Equalization,Grid Visualization,Icon Visualization,Triangle Visualization - outputs:
Keypoint Detection Model,Clip Comparison,Morphological Transformation,SAM 3,Qwen-VL,VLM As Detector,Email Notification,Twilio SMS/MMS Notification,YOLO-World Model,MoonshotAI Kimi,Polygon Zone Visualization,OpenAI,VLM As Detector,Heatmap Visualization,Keypoint Visualization,Llama 3.2 Vision,Anthropic Claude,Stability AI Image Generation,Google Vision OCR,Seg Preview,Camera Focus,Label Visualization,SAM 3,Instance Segmentation Model,Qwen3.5,Multi-Label Classification Model,SmolVLM2,Google Gemini,Motion Detection,Background Color Visualization,Mask Edge Snap,Instance Segmentation Model,Qwen 3.5 API,Google Gemini,Polygon Visualization,Moondream2,SIFT Comparison,Florence-2 Model,Barcode Detection,Time in Zone,Single-Label Classification Model,OCR Model,VLM As Classifier,Qwen2.5-VL,Detections Stabilizer,LMM For Classification,Keypoint Detection Model,SIFT,Image Preprocessing,Roboflow Dataset Upload,Corner Visualization,Stability AI Outpainting,Segment Anything 2 Model,Multi-Label Classification Model,Halo Visualization,Qwen3-VL,Qwen3.5-VL,Semantic Segmentation Model,Blur Visualization,Perception Encoder Embedding Model,Morphological Transformation,Trace Visualization,VLM As Classifier,Gaze Detection,Reference Path Visualization,Halo Visualization,Model Comparison Visualization,Dot Visualization,Pixel Color Count,Background Subtraction,QR Code Detection,Text Display,ByteTrack Tracker,Absolute Static Crop,Florence-2 Model,Byte Tracker,Icon Visualization,Object Detection Model,Perspective Correction,SAM 3,BoT-SORT Tracker,Stability AI Inpainting,Image Convert Grayscale,Object Detection Model,OpenRouter,OpenAI,Llama 3.2 Vision,Image Threshold,OC-SORT Tracker,Anthropic Claude,Dynamic Crop,Clip Comparison,Dominant Color,Contrast Enhancement,Bounding Box Visualization,Depth Estimation,Keypoint Detection Model,CLIP Embedding Model,Image Contours,EasyOCR,Relative Static Crop,Multi-Label Classification Model,Polygon Visualization,Google Gemma API,Qwen 3.6 API,Template Matching,Single-Label Classification Model,Image Blur,Anthropic Claude,Triangle Visualization,Object Detection Model,OpenAI,Image Stack,Pixelate Visualization,Single-Label Classification Model,OpenAI,Instance Segmentation Model,Buffer,Stitch Images,Image Slicer,Line Counter Visualization,Image Slicer,Semantic Segmentation Model,LMM,Roboflow Dataset Upload,Color Visualization,Google Gemini,Classification Label Visualization,Camera Focus,Camera Calibration,Detections Stitch,Ellipse Visualization,SORT Tracker,Mask Visualization,GLM-OCR,Crop Visualization,Circle Visualization,CogVLM,SAM2 Video Tracker,Contrast Equalization,Roboflow Vision Events,MoonshotAI Kimi,Google Gemma
Input and Output Bindings¶
The available connections depend on its binding kinds. Check what binding kinds
Relative Static Crop in version v1 has.
Bindings
-
input
images(image): The image to infer on..x_center(float_zero_to_one): X coordinate of the center point of the crop region as a relative value (0.0 to 1.0). 0.0 represents the left edge of the image, 1.0 represents the right edge, and 0.5 represents the center horizontally. The crop region is centered at this X coordinate after converting to absolute pixels. The actual crop boundaries are calculated as x_min = x_center - width/2 and x_max = x_min + width, where all values are converted to pixels based on image width. If the calculated crop extends beyond image bounds, the crop will be clipped or may return None if the crop would be empty. Relative coordinates adapt to different image sizes - the same relative value extracts the same proportional position from images of any size..y_center(float_zero_to_one): Y coordinate of the center point of the crop region as a relative value (0.0 to 1.0). 0.0 represents the top edge of the image, 1.0 represents the bottom edge, and 0.5 represents the center vertically. The crop region is centered at this Y coordinate after converting to absolute pixels. The actual crop boundaries are calculated as y_min = y_center - height/2 and y_max = y_min + height, where all values are converted to pixels based on image height. If the calculated crop extends beyond image bounds, the crop will be clipped or may return None if the crop would be empty. Relative coordinates adapt to different image sizes - the same relative value extracts the same proportional position from images of any size..width(float_zero_to_one): Width of the crop region as a relative value (0.0 to 1.0). 1.0 represents 100% of the image width, 0.5 represents 50% of the image width, etc. Defines the horizontal extent of the crop as a proportion of the image width. The crop extends width/2 pixels to the left and right of the x_center coordinate after converting to absolute pixels. Total crop width equals this relative value multiplied by the image width. If the calculated crop extends beyond the image's width, it will be clipped to image boundaries. Relative width adapts to different image sizes - the same relative value extracts the same proportional width from images of any size..height(float_zero_to_one): Height of the crop region as a relative value (0.0 to 1.0). 1.0 represents 100% of the image height, 0.5 represents 50% of the image height, etc. Defines the vertical extent of the crop as a proportion of the image height. The crop extends height/2 pixels above and below the y_center coordinate after converting to absolute pixels. Total crop height equals this relative value multiplied by the image height. If the calculated crop extends beyond the image's height, it will be clipped to image boundaries. Relative height adapts to different image sizes - the same relative value extracts the same proportional height from images of any size..
-
output
crops(image): Image in workflows.
Example JSON definition of step Relative Static Crop in version v1
{
"name": "<your_step_name_here>",
"type": "roboflow_core/relative_statoic_crop@v1",
"images": "$inputs.image",
"x_center": 0.3,
"y_center": 0.3,
"width": 0.3,
"height": 0.3
}