Types of Blur in OpenCV

less than 1 minute read

Averaging

cv2.blur(image=image,ksize=(3,3))

average blur with ksize 3 and 7

average

change kernel size for blur depth

Note:-

No need to bother about kernel and kernelsize just remember them as a factor for blur depth

Gaussian Blur

  • kernel size should be positive and odd
     gaussian=cv2.GaussianBlur(src=image,ksize=(5,5),sigmaX=0)
     # we should give sigmaX & sigmaY, if only x is given then y will bw taken same as of x
    

    again all these are factors for blur effect

gaussian

Median Blur

  • Reduces noise in image
  • kernel size shouldbe positive and odd
median = cv2.medianBlur(image,3)
median2 = cv2.medianBlur(image,7)

median

Bilateral Filter

  • Bilateral Filter effective in noise removal while keeping edges sharp

bilateralFilter ( InputArray src, OutputArray dst, int d, double sigmaColor, double sigmaSpace, #int borderType = BORDER_DEFAULT)

bilateralfilter_blur = cv2.bilateralFilter(image, 9, 75, 75)

types1 types2

Updated: