Last active
December 20, 2015 22:39
-
-
Save khajer/6206332 to your computer and use it in GitHub Desktop.
python + opencv : test camera
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cv | |
| cv.NamedWindow("testcam", cv.CV_WINDOW_AUTOSIZE) | |
| camera_index = 0 | |
| capture = cv.CaptureFromCAM(camera_index) | |
| def repeat(): | |
| global capture #declare as globals since we are assigning to them now | |
| frame = cv.QueryFrame(capture) | |
| cv.ShowImage("w1", frame) | |
| c = cv.WaitKey(10) | |
| if c == ord('q'): | |
| exit(0) | |
| while True: | |
| repeat() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment