Skip to content

Instantly share code, notes, and snippets.

@khajer
Last active December 20, 2015 22:39
Show Gist options
  • Select an option

  • Save khajer/6206332 to your computer and use it in GitHub Desktop.

Select an option

Save khajer/6206332 to your computer and use it in GitHub Desktop.
python + opencv : test camera
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