使用boxFilter函数时出现以下错误:
SystemError: new style getargs format but argument is not a tuple
以下是代码片段:
//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)
它说这个论点不是一个元组。如何使它成为元组?我试图搜索很多,但没有有用的结果。我是openCV和python的初学者。 以下是过滤器的定义:
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.
提前致谢。
答案 0 :(得分:2)
我得到了它的工作:
cv2.boxFilter(imgcv1, 0, (7,7), imgcv1, (-1,-1), False, cv2.BORDER_DEFAULT)
我给出的分数为7而不是(7,7)并且深度为1而不是0.而且Python将False视为布尔值而我尝试使用0来代替它。啊,很多错误。希望有一天它会帮助像我这样的其他初学者。