Skip to content

Instantly share code, notes, and snippets.

@peter-mcconnell
Created April 4, 2014 12:10
Show Gist options
  • Select an option

  • Save peter-mcconnell/9973305 to your computer and use it in GitHub Desktop.

Select an option

Save peter-mcconnell/9973305 to your computer and use it in GitHub Desktop.
python - take multiple photos
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