简体   繁体   中英

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(src, ksize[, dst[, anchor[, borderType]]]) → dst

So, I think you meant

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

也许你有打开使用cv2.imreadcv.CreateImage instread图像可以使用imwrite只有当您使用imread打开的图像。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM