Skip to content

Instantly share code, notes, and snippets.

@manuthu
Last active October 18, 2016 15:56
Show Gist options
  • Save manuthu/dc57947c62d9c17f4553c1cb2ebdfc91 to your computer and use it in GitHub Desktop.
Save manuthu/dc57947c62d9c17f4553c1cb2ebdfc91 to your computer and use it in GitHub Desktop.
Take a picture on a mac using cv2
# The following gist uses python opencv2 (http://opencv.org) to take a pic
import cv2
def capture_image(image_file):
video = cv2.VideoCapture()
video.open(0)
_, image = video.retrieve()
video.release()
cv2.imwrite(image_file, image)
capture_image('my-pic.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment