Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webcam capture using OpenCV only capturing one frame #3

Open
devedse opened this issue May 23, 2019 · 0 comments
Open

Webcam capture using OpenCV only capturing one frame #3

devedse opened this issue May 23, 2019 · 0 comments

Comments

@devedse
Copy link

devedse commented May 23, 2019

I've written the following code:

import cv2
import numpy as np
import time

print("Starting...")

time.sleep(1)

c = cv2.VideoCapture(0)

while(1):
    print("Capturing...")

    didItWork,f = c.read()

    print(didItWork)

    cv2.imwrite("output.jpg", f)
cv2.destroyAllWindows()

The first frame is captured correctly and stored as output.jpg, however after that it hangs on the c.read() code.

I can't even cancel the program by pressing CTRL + C. Only if I unplug the webcam afterwards it seems to exit:
image
(I pressed CTRL + C after the second Capturing..., after that I unplugged the webcam and then the messages came regarding traceback....)

I'm not really sure where to start so I was hoping you might have an idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant