Ask Your Question

cdsboy's profile - activity

2013-11-27 11:57:35 -0600 asked a question 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():
  err, frame = vc.read()
  cv2.imwrite("test.png", frame)

And I've tried:

import cv2
import time

vc = cv2.VideoCapture(0)
if vc.isOpened():
  err, frame = vc.read()
  while True:
    if frame is not None:
      cv2.imwrite("test.png", frame)
      break
    err, frame = vc.read()
    time.sleep(.1)'

But those don't seem to work.