Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use cv.boxFilter() in python

I am having following error when I use the boxFilter function:

SystemError: new style getargs format but argument is not a tuple

Here is the code sniplet:

//After downloading image from url, I process it as follows
imgcv = cv2.cvtColor(np.asarray(im), cv.CV_RGB2YCrCb)
#Get the channel 0 
imgcv1 = cv2.split(imgcv)[0] 
cv2.boxFilter(imgcv1, 1, 7, data, (1,1), 0, cv2.BORDER_DEFAULT)

It says the argument is not a tuple. How to make it into tuples? I tried to search a lot but no helpful results. I am a beginner in openCV and in python. Here is the definition of the filter:

cv2.boxFilter(src, ddepth, ksize[, dst[, anchor[, normalize[, borderType]]]]) → dst
Parameters: 
    src – Source image.
    dst – Destination image of the same size and type as src .
    ksize – Smoothing kernel size.
    anchor – Anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center.
    normalize – Flag specifying whether the kernel is normalized by its area or not.
    borderType – Border mode used to extrapolate pixels outside of the image.