Reputation: 261
I'm trying to create a 1 pixel kernel:
x = cv2.getGaussianKernel(1, 2)
And I use it in a gaussian filter:
blur = cv2.GaussianBlur(img, x, 0)
As a result, an error occurs:
SystemError: new style getargs format but argument is not a tuple
How to fix this error?
Upvotes: 0
Views: 6795
Reputation: 1978
You cannot pass a kernel to the GaussianBlur function. You must pass the kernel size.
So x should be a tuple like (5,5) or (3,3) etc
Also the kernel size values should be Odd and positive and can differ. You cannot use the size(1,2) since 2 is even.
If you want to see the Gaussian kernel use this:
cv2.getGaussianKernel(ksize, sigma[, ktype])
EX:
kernel = cv2.getGaussianKernel(ksize=(1,1),sigma=2)
If you want to blur the image using the kernel then use this:
cv2.GaussianBlur(src, ksize, sigmaX[, dst[, sigmaY[, borderType]]])
EX:
cv2.GaussianBlur(src, ksize=(1,1))
check this
Upvotes: 2