Crash when using USB webcam in multiprocessing process

asked 2013-08-22 07:44:52 -0500

Mike Lawrence gravatar image

updated 2013-08-22 08:18:15 -0500

I'm running OpenCV 2.4.5 via the cv2 python bindings, using OS X (10.8.4). I'm trying to capture images from a USB webcam in a separate process via the multiprocessing module. Everything seems to work if I use my laptop's (2011 macbook air) internal webcam, but when I attempt to read a usb webcam (Logitech C920), I get a crash. The crash log is here. Code I'm using that will reliably reproduce the crash is below. Getting this working is pretty mission-critical for me, so any help would be greatly appreciated!

import multiprocessing
import cv2 #doesn't matter if you import here or in cam()

def cam():
    vc = cv2.VideoCapture(0) #modify 0/1 to toggle between USB and internal camera
    while True:
        junk,image = vc.read()

camProcess = multiprocessing.Process( target=cam )
camProcess.start()

while True:
    pass
edit retag flag offensive close merge delete