简体   繁体   English

opencv-python:不是一个numpy数组

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

I want to use the current array to be the output array of the blur operation made in the frame image and im getting this error: 我想使用当前数组作为帧图像中的模糊操作的输出数组,我得到这个错误:

TypeError: <unknown> is not a numpy array

I already checked and both are arrays of the same size and type, I dont understand why this is happening. 我已经检查过,两个都是相同大小和类型的数组,我不明白为什么会发生这种情况。

Part of the code: 部分代码:

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))

The arguments to cv2.blur , as described in the documentation , are the following: 文档中所述 cv2.blur的参数如下:

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

So, I think you meant 所以,我认为你的意思

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