Image ROI Center

This function block is utilized to crop an image based on specified center coordinates, width, and height. It allows users to define a specific region of interest (ROI) within an image for further processing.

📥 Inputs

Image Any The input image from which the region of interest will be extracted.

Center A point representing the center of the region you want to crop.

Width The width of the cropping area.

Height The height of the cropping area.

📤 Outputs

Image Any The cropped image extracted from the specified region of interest.

Rectangle The coordinates of the rectangular area that defines the ROI.

🕹️ Controls

This function block does not have direct controls, as input parameters will be directly specified through the connected nodes.

🎨 Features

Flexible Cropping Allows specifying the cropping area dynamically based on the center coordinates and adjustable dimensions.

Output Rectangle Coordinates Outputs the coordinates of the cropped rectangle, providing useful information about the cropping area for further processing or annotation.

📝 Usage Instructions

  1. Connect Input Image: Link an image to the Image Any input.

  2. Specify Center: Provide a point for the center of the cropping area in the Center input.

  3. Set Dimensions: Define the desired Width and Height for the cropping area.

  4. Evaluate Block: Run the block to process the image and obtain the cropped output along with the rectangle coordinates.

📊 Evaluation

When executed, this function block will output the area of the image defined by the center point and specified dimensions, resulting in a new image that is a cropped version of the original.

💡 Tips and Tricks

Setting Center Coordinate

Make sure the center coordinates are valid within the bounds of the original image to prevent errors.

Ensure Valid Dimensions

Ensure that the defined width and height of the cropping area do not exceed the dimensions of the original image.

You may want to add a step using the Image Resolution and Channel Value block to correctly check the original dimensions.

Using with Other Functions

This block works well with the Show Image block for visual confirmation of the ROI after cropping.

🛠️ Troubleshooting

Cropped Image is Empty

If the resulting cropped image appears empty, ensure that the center coordinates and dimensions are set correctly for the area you intend to crop.

Coordinates Out of Bounds

If you encounter an error regarding out-of-bound coordinates, double-check the inputs to confirm they remain within the boundaries of the original image dimensions.

Last updated