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

  1. Connect your image source to the Image Any input.

  2. Optionally provide a Center coordinate to change the crop center.

  3. Optionally provide Width and/or Height to set the crop size.

  4. Use the Image Any output as the cropped image and the Rectangle output 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 Image to preview the cropped result quickly.

  • Use Image ROI Select or Image ROI Polygon earlier in the flow to interactively define or refine the center before feeding it into this block.

  • Feed the cropped output to Find Object, Object Detection or Mask Detection to focus detection on a smaller area and speed up processing.

  • Add Image Resize after this block to normalize crop size for algorithms that expect fixed input dimensions.

  • Send the cropped image to Image Logger or Image Write to save samples of the region of interest for inspection or training.

πŸ› οΈ Troubleshooting

  • If the crop is empty or looks incorrect, check the Center, Width and Height inputs 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 Resize or color conversions before that block.

  • If you see unexpected coordinates, use Show Image or Draw Rectangle to visualize the Rectangle output and verify the ROI placement.

Last updated

Was this helpful?