cv2.blur() 错误的论点?

cv2.blur() bad argument?

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

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

然后出现这个错误。

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

我想知道错误的原因

看签名(帮助是你的朋友!):

>>> 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.
    ...

由于您跳过了 'dst',因此您必须在之后明确指定 'named args':

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