Check whether an object is completely within an image¶
This function tests whether an object (defined as nonzero pixels in a mask) falls completely within the bounds of an image or if it touches the edge.
- mask = a single channel image (i.e. binary or greyscale)
- This function could be used to test whether the plant has grown outside the field of view.
Output data stored: Data ('in_bounds') automatically gets stored to the
Outputsclass when this function is ran. These data can always get accessed during a workflow (example below). For more detail about data output see Summary of Output Observations
from plantcv import plantcv as pcv img, path, img_filename = pcv.readimage("home/user/images/test-image.tif") gray_img = pcv.rgb2gray_lab(img,'a') mask = pcv.threshold.binary(gray_img, 36, 255, 'light') in_bounds = pcv.within_frame(mask) #True or False?