Sobel Filter

This is a filtering method used to identify and highlight coarse changes in pixel intensity based on the 1st derivative.

plantcv.sobel_filter(gray_img, dx, dy, k)

returns filtered image

Original grayscale image

Screenshot

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"

# Apply to a grayscale image
# Filtered image will highlight areas of coarse pixel intensity change based on 1st derivative
lp_img = pcv.sobel_filter(img, 1, 0, 1)
lp_img = pcv.sobel_filter(img, 0, 1, 1)

Sobel filtered (x-axis)

Screenshot

Sobel filtered (y-axis)

Screenshot