Ask Your Question

Initialization Delay on Mac Camera

asked 2013-11-03 09:27:00 -0500

bradeaton-okc gravatar image

I have a MacBook Air with a built-in camera, a Thunderbolt display with built-in camera, and an external Logitech camera. I'm running Mac OS X 10.9 (Mavericks). I first ran into this problem using straight OpenCV. There is a lag in the time it takes for valid images to start getting returned from any of the cameras. Using an OpenCV example:

webcam = cv2.VideoCapture(1)
if webcam.isOpened():
    rval, frame =
    rval = False

At this point in the program, webcam.isOpened() returns True. But frame isn't a valid image. Its height and width are 0 and any code that assumes that frame contains a valid image will generate an error. In OpenCV, I can work around this by continuing to read from the camera until I get a valid image (a couple of seconds).

In SimpleCV, I can't seem to work around this in the same way. I get an error even trying to read from the camera as this code illustrates:

cam = Camera(1)
display = Display()
while True:
    img = cam.getImage()

This code will immediately generate the error:

> OpenCV Error: Bad argument (Array > should be CvMat or IplImage) in > cvGetSize, file > /tmp/opencv-5jc8/opencv-, > line 1238

So it appears something has changed in the interface to cameras on the Mac that SimpleCV is not prepared to handle. Has anyone else run into something similar? Is there some change to a config file I don't know about? Any help would be appreciated.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2013-11-05 05:48:20 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I have the same problem on macbook air OSX 10.8 with XCode 5.0

edit flag offensive delete link more

answered 2013-11-14 03:09:07 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Just running into similar setting with Opencv webcam usage. But mostly i use C/C++. My experience is as long as i use the C api (the one with CvCapture) my webcam shows up normally, yet if i switch to C++ api (the one with VideoCapture) i couldn't get any frame from my camera (or couldn't get the first frame?) running a macbook pro OSX 10.9 with home-brewed opencv (my python opencv couldn't link after 10.9, still fixing it)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-11-03 09:27:00 -0500

Seen: 1,023 times

Last updated: Nov 14 '13