1

This code is running, but it takes four seconds (or four pictures) to detect a movement.

The pictures are 640px x 480px.

Lenovo T520, ELP camera - 1920 x 1080 - ELP Svpro 5-50mm, python3.

I've tried the same code with cap = VideoStream(src=1).start() and it's running perfect.

It's a mystery to me

Why is cap = cv2.VideoCapture(1) so slowly?

ps: one second wait time between pictures is intentional

import cv2


#could be 0 for laptop camera, 1 for second camera
cap = cv2.VideoCapture(1)

count = 0
while True:
    _, frame = cap.read()

    cv2.imshow("Frame", frame)

    key = cv2.waitKey(1000)


    print(count)
    count +=1

    #27 is escape key
    if key == 27:
        break

cap.release()
cv2.destroyAllWindows()
J. Doe278
  • 11
  • 2

0 Answers0