Use drawing tools or code to extract a region from an image.
Select the Mask Tool from the image toolbar
Click an image and select the Mask Tool in the image toolbar:
Use the drawing tools to mark the region you want to extract
Use the drawing tools to mark one or more areas in the image. You can move and resize an area to fine-tune it after you have drawn it:
- Hold down to draw squares with the rectangle tool or circles with the circle/ellipse tool.
- Use the Eraser Tool to remove a marked area: select the Eraser, then click the areas you want to remove.
Copy the region to the clipboard
Click Copy and choose the format to copy to the clipboard (the region is referred to in the menu as a “Mask”):
Paste the region into an expression
To compute with the region, paste it into an expression and evaluate:
- Due to image autoscaling, the displayed sizes of same-size images may differ.
There is no general recipe for extracting image regions programmatically. The specific code depends on the image and what region you want to extract.
For this image of a watch with a large, bright dial, the following code will extract the dial region:
Here is the same code broken into individual image processing steps: