python - opencv-python:不是一个numpy数组

我想使用当前数组作为在帧图像中进行的模糊操作的输出数组,并且我收到此错误:

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

最佳答案

如in the documentation所述,cv2.blur的参数如下:

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

所以,我想你的意思是
current= cv2.blur(frame, (15,15))

https://stackoverflow.com/questions/14514369/

相关文章:

opencv - "cache"cv Warp透视图

python - 用于在 python 中存储多个图像的高效数据结构

docker - WSL2 无法连接到 Docker 守护程序

image-processing - 使用 openCV 检测图案区域

opencv - OpenCV Codebook方法-背景模型

c++ - 负 RGB 值

opencv - 最大颜色数和最大深度

eclipse - fatal error : opencv2/core/core_c. h:没有这

opencv - 在OpenCV中编译

image - GUI,可在ubuntu12.04中使用OpenCV查看图像中的值