Image ROI Polygon

This function block allows users to define a region of interest (ROI) by drawing a polygon on an image using mouse clicks. The defined ROI can be used for further image processing.

📥 Inputs

Input Image The image on which the polygon ROI will be drawn.

📤 Outputs

Output Image The resulting image showing only the area defined by the drawn polygon.

Polygon The coordinates of the polygon points that define the ROI.

🕹️ Controls

Mouse Click Click on the image to add vertices of the polygon. Each click adds a point.

Key Press

  • C: Clears all points and the polygon.

  • U: Undoes the last added point.

🎨 Features

Interactive Drawing Users can draw polygons directly on the image by clicking to set points, allowing for flexible ROI selection.

Dynamic Line Visualization As users click to define the polygon, lines and points are dynamically drawn on the image for immediate visual feedback.

📝 Usage Instructions

  1. Connect an Image: Link an image to the Input Image socket.

  2. Draw Polygon: Click on the image to add points. Connect at least three points to form a closed polygon.

  3. Clear or Undo: Use the C key to clear all points or the U key to remove the last point.

  4. Evaluate: Run the function block to obtain the output image focusing only on the defined ROI.

📊 Evaluation

When executed, this function block generates an output image highlighting only the area included within the polygon drawn by the user.

💡 Tips and Tricks

Complex Shapes

You can create complex shapes by clicking around the desired area; just ensure to close the polygon by connecting the last point to the first one.

With Layers

This function block can be combined effectively with other function blocks like Image Threshold or Bilateral Filter to enhance specific areas before or after defining the ROI.

Check Polygon Coordinates

The output polygon coordinates can be stored or used as input for other processing functions that require specific area references.

🛠️ Troubleshooting

Polygon Not Displaying

Make sure that there is an image connected to the input socket and that you click to create at least three points to define a closed shape.

Unexpected Output

Ensure you haven't accidentally cleared the points or undone several clicks. Use the U key to redo the last action if needed.

Last updated