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:
Icon Visualization,Line Counter Visualization,Perspective Correction,Image Preprocessing,Blur Visualization,Morphological Transformation,Image Slicer,QR Code Generator,Pixelate Visualization,Stitch Images,Identify Changes,Detections Consensus,Color Visualization,Contrast Equalization,Stability AI Outpainting,Circle Visualization,Stability AI Image Generation,Grid Visualization,Relative Static Crop,Image Blur,Reference Path Visualization,SIFT,Image Slicer,Image Contours,Stability AI Inpainting,Camera Focus,Halo Visualization,Polygon Zone Visualization,Trace Visualization,Identify Outliers,SIFT Comparison,Dot Visualization,Camera Focus,Image Convert Grayscale,Classification Label Visualization,Crop Visualization,Clip Comparison,Background Color Visualization,Bounding Box Visualization,Background Subtraction,Camera Calibration,Dynamic Crop,Triangle Visualization,Polygon Visualization,Text Display,Keypoint Visualization,Ellipse Visualization,Image Threshold,Corner Visualization,Mask Visualization,Depth Estimation,Absolute Static Crop,Model Comparison Visualization,Label Visualization - outputs:
Icon Visualization,Image Preprocessing,LMM,Blur Visualization,Moondream2,Morphological Transformation,Stitch Images,Color Visualization,Contrast Equalization,Gaze Detection,Llama 3.2 Vision,Stability AI Image Generation,Template Matching,Image Blur,Reference Path Visualization,Circle Visualization,SIFT,OpenAI,Buffer,SAM 3,Perception Encoder Embedding Model,Halo Visualization,EasyOCR,Google Gemini,Roboflow Dataset Upload,Trace Visualization,Twilio SMS/MMS Notification,Instance Segmentation Model,Single-Label Classification Model,VLM as Detector,Classification Label Visualization,Clip Comparison,Image Convert Grayscale,CogVLM,Google Vision OCR,Background Color Visualization,Multi-Label Classification Model,Qwen2.5-VL,QR Code Detection,Single-Label Classification Model,Camera Calibration,VLM as Detector,Segment Anything 2 Model,LMM For Classification,Triangle Visualization,Text Display,CLIP Embedding Model,SAM 3,Ellipse Visualization,Seg Preview,Multi-Label Classification Model,Barcode Detection,OpenAI,Mask Visualization,Anthropic Claude,Absolute Static Crop,Google Gemini,Time in Zone,Polygon Zone Visualization,Polygon Visualization,Model Comparison Visualization,Label Visualization,Line Counter Visualization,Perspective Correction,Florence-2 Model,Dominant Color,Image Slicer,Instance Segmentation Model,Stability AI Outpainting,Object Detection Model,Anthropic Claude,Keypoint Detection Model,VLM as Classifier,Relative Static Crop,Byte Tracker,Image Slicer,Pixel Color Count,VLM as Classifier,Image Contours,Stability AI Inpainting,Camera Focus,Google Gemini,Motion Detection,Florence-2 Model,Object Detection Model,SIFT Comparison,Detections Stitch,Keypoint Detection Model,Dot Visualization,Camera Focus,YOLO-World Model,Crop Visualization,Clip Comparison,Bounding Box Visualization,OCR Model,Background Subtraction,OpenAI,SAM 3,Detections Stabilizer,Roboflow Dataset Upload,Qwen3-VL,Dynamic Crop,Keypoint Visualization,Email Notification,Image Threshold,Anthropic Claude,Corner Visualization,Depth Estimation,OpenAI,Pixelate Visualization,SmolVLM2
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
}