2013-03-18 39 views
0

我有以下錯誤,當我使用boxFilter函數功能:如何正確使用cv.boxFilter()在python

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

下面是代碼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) 

報告說,參數不是一個元組。如何使它成爲元組?我試圖搜索很多,但沒有有用的結果。我是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. 

在此先感謝。

回答

1

我得到它的工作:

cv2.boxFilter(imgcv1, 0, (7,7), imgcv1, (-1,-1), False, cv2.BORDER_DEFAULT) 

我給點爲7,而不是(7,7),並給予而不是0深度1,同樣的Python需要假布爾和我嘗試0代替它。啊,很多錯誤。希望有一天能幫助像我這樣的其他初學者。

相關問題