Home > Blockchain >  cv2.blur() bad argument?
cv2.blur() bad argument?

Time:11-10

img = cv2.imread("C:....\\DogInCar.png", cv2.IMREAD_GRAYSCALE)

blur = cv2.blur(img, (5, 5), (-1, -1), cv2.BORDER_REFLECT)

And this error appeared.

cv2.error: OpenCV(4.5.4-dev) :-1: error: (-5:Bad argument) in function 'blur'
> Overload resolution failed:
>  - Can't parse 'anchor'. Input argument doesn't provide sequence protocol
>  - Can't parse 'anchor'. Input argument doesn't provide sequence protocol

I would like to know the reason for the error.

CodePudding user response:

look at the signature (help is your friend !):

>>> help(cv2.blur)
Help on built-in function blur:

blur(...)
    blur(src, ksize[, dst[, anchor[, borderType]]]) -> dst
    .   @brief Blurs an image using the normalized box filter.
    ...

since you skip 'dst', you have to specify the 'named args' after that explicitly:

blur = cv2.blur(img, (5, 5), anchor=(-1, -1), borderType=cv2.BORDER_REFLECT)
  • Related