Mask-Rectangle

Takes an input image and returns a binary image masked by a rectangular area denoted by p1 and p2. Note that p1 = (0,0) is the top left hand corner bottom right hand corner is p2 = (max-value(x), max-value(y)).

rectangle_mask(img, point1, point2, device, debug=None,color="black")

returns device, masked, binary img, contours, hierarchy

Grayscale image

Screenshot

from plantcv import plantcv as pcv

# Makes a rectangle area that will be treated as a mask
device, masked, binary, contours, hierarchy = pcv.rectangle_mask(img, (0,0), (75,252), device, debug="print", color="black")

Region of interest

Screenshot

Masked image

Screenshot