Set the pixels connected to the border of the mask to zero. You can chose to allow corner connection of not with the allowCorners option.
allowCorners
The mask to process.
Clear border options.
The image with cleared borders.
Set the pixels connected to the border of the mask to zero. You can chose to allow corner connection of not with the
allowCorners
option.