Mask Pen Tool
Learn how to use the Mask Pen annotation tool, a powerful combination of polygonal contours and freeform drawing, to create precise and flexible segmentation masks.
Last updated
Learn how to use the Mask Pen annotation tool, a powerful combination of polygonal contours and freeform drawing, to create precise and flexible segmentation masks.
Last updated
The Mask Pen Tool is a versatile annotation tool that combines the precision of polygonal drawing with the flexibility of freeform brush strokes. This tool allows you to outline objects with both sharp, straight lines and smooth, curved contours, enabling you to create segmentation masks that perfectly match the shape of any object.
The Mask Pen tool helps when objects have a mix of sharp and blurred edges, or when a high level of detail is required in complex environments.
Watch our comprehensive 5-minute video tutorial where our Supervisely expert guides you through the Mask Pen tool's functionalities.
Follow these step-by-step instructions to effectively use the Mask Pen tool for image segmentation.
You can create a new class directly from the Annotation Toolbox. To do this:
Click the Pen Icon in the toolbar of the labeling interface.
Or select an existing object class or add a new class by clicking Add new class definition.
In the modal window, enter the class name, choose the Mask or Any shape, and configure additional settings (e.g., color, hotkeys).
Click the Create
button to add the new class to the definitions list.
Select the newly created class and segment the object with the mask in the image or video.
You can start by drawing a polygon or a freehand shape mask around the object area.
Polygon Mode: Click on the image to create points along the boundary of the object. Each click adds a new point, forming a straight line between them. This mode is ideal for objects with well-defined, straight edges.
Brush Mode: Hold the SHIFT
key to switch between modes and, while holding down the left mouse button, draw free-form shapes. This is useful for objects with irregular boundaries.
To finish drawing the mask, connect the last point to the starting point or press the SPACE
key to close the shape. This creates a closed mask around the object.
You can easily modify the mask after the figure is completed. To add parts to the mask, select the object and draw the new sections you want to include. To erase parts of the mask, hold the SHIFT
key and draw over the area to be removed.
Fill holes in the mask If there are gaps or holes in the mask, use the Bucket Fill tool to quickly fill them with a single click. The selected object will be highlighted with a grid of dots, indicating the area to be filled.
Segmentation of partially visible objects
Unlike a regular polygon, the Mask Pen tool lets you pick spread out parts of an object in the image, even if they're not connected thanks to its integrated brush functions. Each part you select belongs to just one object until you press the SPACE
key and choose a new shape.
Split the mask into two figures If you need to split a single mask into multiple separate objects, use the Polygon Split tool:
Outline the area to be separated and reconnect it to the starting point. Splitting the figure into parts results in multiple objects of the same class, which can then be individually classified.
If necessary, Change the class of each part of an object. You can opt for two alternative methods:
Right-click on the object and chose Change Class, OR
Select the object from the right panel and modify its class.
Once you've finished adjusting the mask, press SPACE
or click the first point again to complete the annotation. This will save your changes and create a final segmentation mask.
Hint: To quickly cut out the specific pixels of an object, click randomly near the object's boundary in areas without nearby objects.
Use the Object Color Randomizer to instantly change the color of any object with a single click, as often as you like. This is particularly useful if you have many objects of the same class, or if they are close together, so you can easily differentiate between masks.
Discover all the advanced features and unique applications of the Pen Tool in our comprehensive blog post.
Control the Mask Pen tool more efficiently with HOTKEYS
.
Mask Pen Tool | 9 |
---|---|
Form polygon area | |
Form free shape area | + Draw |
Erase | Hold Shift |
Remove point | Shift + |
Finish | Space |
Finish | Click the first point |
Use Polygon Split (to cut mask into two figures) and Bucket Fill (to fill holes) in the tool subpanel |
---|
Finish area using |
Scene Navigation |
---|
Zoom with |