Skip to content

Instantly share code, notes, and snippets.

@emctoo
Created June 28, 2012 02:16
Show Gist options
  • Save emctoo/3008340 to your computer and use it in GitHub Desktop.
Save emctoo/3008340 to your computer and use it in GitHub Desktop.
read camera with OpenCV
#! /usr/bin/env python
import cv2
if __name__ == "__main__":
''' '''
camera = cv2.VideoCapture(0)
while True:
# cv2.VideoCapture return a tuple, (Bool, Numpy.ndarray)
_, im = camera.read()
cv2.imshow("camera", im)
if cv2.waitKey(40) > 0 : break
print "Exit ..."
@emctoo
Copy link
Author

emctoo commented Jun 28, 2012

Data returned is different from C++ version, check before using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment