Created
April 4, 2014 12:10
-
-
Save peter-mcconnell/9973305 to your computer and use it in GitHub Desktop.
python - take multiple photos
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 cv2 | |
| # Camera 0 is the integrated web cam on my netbook | |
| camera_ports = range(0, 2) | |
| def get_image(): | |
| retval, im = camera.read() | |
| return im | |
| for c in camera_ports: | |
| print("Taking image...") | |
| camera = cv2.VideoCapture(c) | |
| camera_capture = get_image() | |
| file = "snapshot{}.png".format(c) | |
| cv2.imwrite(file, camera_capture) | |
| del(camera) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment