Image ROI Center
This function block crops an image around a specified center point using a desired width and height. If no center or sizes are provided, it defaults to the full image center and full image dimensions. It returns the cropped image and the rectangle coordinates used for the crop.
π₯ Inputs
Image Any
The source image to crop.
Center
Center coordinate for the crop. If not provided the image center is used. Format: (x, y) or (col, row) depending on your workflow.
Width
Desired crop width in pixels. If not provided the image width is used.
Height
Desired crop height in pixels. If not provided the image height is used.
π€ Outputs
Image Any
The cropped image (region of interest) returned as image data.
Rectangle
The rectangle that was used for cropping, expressed as coordinates you can reuse with other blocks.
πΉοΈ Controls
This block has no additional interactive controls inside its widget area. All behavior is driven by the input sockets.
π― Features
Simple center-based cropping for quick ROI extraction.
Accepts optional width, height and center inputs so you can change the ROI dynamically at runtime.
Returns the crop and the rectangle coordinates so downstream blocks can visualize or reuse the ROI.
π Usage Instructions
Connect your image source to the
Image Anyinput.Optionally provide a
Centercoordinate to change the crop center.Optionally provide
Widthand/orHeightto set the crop size.Use the
Image Anyoutput as the cropped image and theRectangleoutput to draw or save the ROI.
βοΈ Running mechanism
When the block runs it determines the center, width and height from the inputs (or falls back to sensible defaults) then computes the rectangle within image bounds and outputs the cropped image together with the rectangle coordinates.
π‘ Tips and Tricks
Combine with
Show Imageto preview the cropped result quickly.Use
Image ROI SelectorImage ROI Polygonearlier in the flow to interactively define or refine the center before feeding it into this block.Feed the cropped output to
Find Object,Object DetectionorMask Detectionto focus detection on a smaller area and speed up processing.Add
Image Resizeafter this block to normalize crop size for algorithms that expect fixed input dimensions.Send the cropped image to
Image LoggerorImage Writeto save samples of the region of interest for inspection or training.
π οΈ Troubleshooting
If the crop is empty or looks incorrect, check the
Center,WidthandHeightinputs to make sure they are within the image bounds.If your downstream block expects a specific channel order or size, make sure to add
Image Resizeor color conversions before that block.If you see unexpected coordinates, use
Show ImageorDraw Rectangleto visualize theRectangleoutput and verify the ROI placement.
Last updated
Was this helpful?