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
xksize
box if integer, (n, m) size box if tuple
- Context:
- Used to reduce image noise
- Example use:
Thresholded 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"
# Apply median blur to a binary image that has been previously thresholded.
blur_5 = pcv.median_blur(gray_img, 5)
Median blur (ksize = 5)
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 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))
Source Code: Here