Auto Crop¶
Crops image to an object and allows user to specify image padding (if desired)
plantcv.auto_crop(img, objects, padding_x=0, padding_y=0, color='black')
returns image after resizing
- Parameters:
- img1 - RGB or grayscale image data
- object - contour of target object
- padding_x - padding in the x direction
- padding_y - padding in the y direction
- color - either 'black' or 'white'
- Context:
- Crops image to object
Input image
from plantcv import plantcv as pcv
# Set global debug behavior to None (default), "print" (to file), or "plot" (Jupyter Notebooks or X11)
pcv.params.debug = "print"
# Resize image
crop_img=pcv.auto_crop(img, id_objects[0],20,20,'black')
Debug Auto Crop Images