Sending webcam stream remotely for use in Python OpenCV

asked 2014-02-08 20:11:08 -0500

J4G gravatar image

updated 2014-02-08 21:03:11 -0500

Hey, I'm trying to send a webcam stream to a remote computer for image processing. I would do the processing directly on the webcam computer, but it's ARM and pretty slow. Right now I have mjpg-streamer set up, which allows me to remotely access image files and a network stream. Originally I intended just to get a stream of individual images with an HTTP Request, but I'd like to use background subtraction which if I understand correctly requires a video stream.

Here's what I currently have, but it's pretty crude.

    urllib.urlretrieve("", "test.jpg")

    im ='test.jpg')'test.jpg')

    frame = cv2.imread('test.jpg')

    fgmask = fgbg.apply(frame)
    fgmask = cv2.morphologyEx(fgmask, cv2.MORPH_OPEN, kernel)

    k = cv2.waitKey(30) & 0xff
    if k == 27:

I have to convert the image to another jpeg or else OpenCV thinks the jpeg data is corrupted.

I'm an OpenCV / Python novice, so any help would be appreciated!

edit retag flag offensive close merge delete