簡體   English   中英

opencv-python:不是一個numpy數組

[英]opencv-python: is not a numpy array

我想使用當前數組作為幀圖像中的模糊操作的輸出數組,我得到這個錯誤:

TypeError: <unknown> is not a numpy array

我已經檢查過,兩個都是相同大小和類型的數組,我不明白為什么會發生這種情況。

部分代碼:

previous = np.zeros((frameHeight,frameWidth,3),np.uint8) #blank image with 640x480 and 3 channels
difference = np.zeros((frameHeight,frameWidth,3),np.uint8)
current = np.zeros((frameHeight,frameWidth,3),np.uint8)

while True:
    # Capture a frame
    flag,frame = capture.read()
    cv2.flip(frame, flipCode=1)

    # Difference between frames
    cv2.blur(frame, current, (15,15))

文檔中所述 cv2.blur的參數如下:

cv2.blur(src, ksize[, dst[, anchor[, borderType]]]) → dst

所以,我認為你的意思

current= cv2.blur(frame, (15,15))

也許你有打開使用cv2.imreadcv.CreateImage instread圖像可以使用imwrite只有當您使用imread打開的圖像。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM