Table of Contents

Class MaskPolygon

Namespace
Bonsai.Vision
Assembly
Bonsai.Vision.dll

Represents an operator that applies a polygonal mask to each image in the sequence.

Editor

To open the Region of Interest (ROI) editor, start the workflow and click on the ellipsis button inside the Regions property in the property grid, or double-click the operator node while holding Ctrl.

Create ROI

To create a new ROI, press and hold the left mouse button anywhere in the editor window and drag the mouse to define a rectangular region of interest. Release the button to complete the selection. Additional ROIs can be created by pressing and holding the left mouse button in any location outside the boundaries of existing ROIs.

Note

You can create an elliptical region of interest by holding Shift while dragging. You can further constrain an elliptical or rectangular region to be circular or square, respectively, by holding Ctrl.

Move ROI

To move an ROI, press and hold the left mouse button anywhere inside the boundaries of an existing region and drag the mouse to reposition it. Releasing the button will complete the move.

Scale ROI

To scale the shape of an ROI, press and hold the left mouse button anywhere inside the boundaries of an existing region and drag the mouse while holding Shift. Dragging the mouse away from the click will scale the region horizontally or vertically proportionally to the X and Y displacement, respectively. Releasing the button will complete the scale action.

Note

You can constrain the scale to preserve the proportions of the original shape by holding Ctrl.

Select ROI

You can select any existing ROI by clicking anywhere inside the boundaries of an existing region, or by pressing the Tab key to cycle between existing ROIs.

Tip

Cycling selected ROIs using the Tab key can be very useful for locating extremely small regions which may have been created by mistake, in case they are hard to pick up by clicking.

Delete ROI

To delete an ROI, first select the ROI, and then press the Del key.

Move control point

To move a control point in the polygonal ROI, press and hold the right mouse button inside the ROI, near the point you want to move, and drag the mouse to reposition the selected point.

Add control point

To add a new control point to the polygonal ROI, double-click with the left mouse button inside the ROI. The new control point will be placed in the middle of the line segment which is closest to the double-click location.

Remove control point

To remove a control point from the polygonal ROI, double-click with the right mouse button inside the ROI. The control point closest to the double-click location will be removed.

Note

A minimum of three points are required to form a polygon; therefore, it is not possible to remove control points from triangular shapes.

Tip

Undo and redo operations are supported on any of the above actions. To undo an action press Ctrl+Z on your keyboard. To redo something you've undone, press Ctrl+Y. You can press these shortcuts multiple times if you want to undo or redo multiple steps.

public class MaskPolygon : CropPolygon
Inheritance
MaskPolygon
Inherited Members

Constructors

MaskPolygon()

Initializes a new instance of the MaskPolygon class.