[英]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.imread的cv.CreateImage instread圖像可以使用imwrite只有當您使用imread打開的圖像。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.