Occasionally the segmentation result may not provide a completely accurate mask or you may want to allow a user to update the mask manually. You can achieve this by modifying the alpha mask directly.
- From the
SegmentationResult, export the alpha mask to a bitmap:
- Add or erase the desired pixels to the alpha mask by set the alpha to 0 if you want to remove it, 1 if you want to add the pixel. You’ll have to implement this yourself.
- Use the alpha mask to cut out from the original image:
Bitmap finalResult = visionImage.mask(yourModifiedBitmap);