Apply Mask

Apply binary mask to an image.

apply_mask(img, mask, mask_color, device, debug=None)

returns device, masked image

Original RGB image

Screenshot

Mask image

Screenshot

from plantcv import plantcv as pcv

# Apply binary 'white' mask over an image. 
device, masked_image = pcv.apply_mask(img, mask, 'white', device, debug="print")

White-masked image

Screenshot

from plantcv import plantcv as pcv

# Apply binary 'black' mask over an image.
device, masked_image = pcv.apply_mask(img, mask, 'black', device, debug="print")

Black-masked image

Screenshot