Median Blur

Applies a median blur filter. Applies median value to central pixel within a kernel size. The function is a wrapper for the SciPy function median filter.

plantcv.median_blur(gray_img, ksize)**

returns blurred image

  • Parameters:
    • gray_img - Grayscale image data
    • ksize - kernel size => integer or tuple, ksize x ksize box if integer, (n, m) size box if tuple
  • Context:
    • Used to reduce image noise
  • Example use:

Thresholded 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 = "plot"

# Apply median blur to a binary image that has been previously thresholded.
blur_5 = pcv.median_blur(gray_img, 5)

Median blur (ksize = 5)

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 = "plot"

# Apply median blur to a binary image that has been previously thresholded.
blur_11 = pcv.median_blur(gray_img, (11, 11))

Median blur (ksize = (11,11))

Screenshot

Source Code: Here