Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Crash when using USB webcam in multiprocessing process

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 plug in 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
click to hide/show revision 2
clarified that it's about reading from usb, not simply plugging in

Crash when using USB webcam in multiprocessing process

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 plug in 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