# Image Capture from Macbook Webcam on OS X 10.8?

I'm having issues taking a picture without opening up a window on os x. If I open a window up, I can take a picture no problem, but no matter what I try without opening a window I can not get it to work.

I've tried:

import cv2
vc = cv2.VideoCapture(0)
if vc.isOpened():
cv2.imwrite("test.png", frame)


And I've tried:

import cv2
import time

vc = cv2.VideoCapture(0)
if vc.isOpened():
while True:
if frame is not None:
cv2.imwrite("test.png", frame)
break