skip to Main Content

Please help me implement Surface blur (like Photoshop) in OpenCV, Python. I spent a lot of time to searching it, but I found nothing.

2

Answers


  1. Try cv2.filter2D function

    import cv2
    import numpy as np 
    
    kernel = np.ones((5,5),np.float32)/25
    img = cv2.imread('imagename.extension')
    blurred = cv2.filter2D(img, -1, kernel)
    cv2.imwrite('blurred_image.extension', blurred)
    
    Login or Signup to reply.
  2. According to the description given here of the surface blur filter, you can use bilateral filtering.
    I’m qouting from the above link.

    The Surface Blur filter blurs an image while preserving edges. This
    filter is useful for creating special effects and for removing noise
    and graininess.

    Also check here and here for additional details and this opencv tutorial on filtering.

    In the example below, I’m using the image given in the shellandslate site.

    import cv2 as cv
    im = cv.imread('input.png')
    blur = cv.bilateralFilter(im,9,75,75)
    

    Result:

    input
    blur

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search