Perform morphological 'erosion' filtering. Keeps pixel in center of the kernel if conditions set in kernel are true, otherwise removes pixel.
plantcv.erode(gray_img, ksize, i)
returns image after erosion
- gray_img - Grayscale (usually binary) image data
- ksize - Kernel size, an odd integer that is used to build a ksize x ksize matrix using np.ones. Must be greater than 1 to have an effect
- i - An integer for number of iterations, i.e. the number of consecutive filtering passes
- Used to perform morphological erosion filtering. Helps remove isolated noise pixels or remove boundary of objects.
- Example use:
Input grayscale 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" # Perform erosion filtering # Results in removal of isolated pixels or boundary of object removal er_img = pcv.erode(gray_img, ksize, 1)
Image after erosion