Quote:
Originally Posted by sst.thad
As for grabbing the image directly, openCV has no way of just opening a jpg over the network.
|
Not true. If you have ffmpeg support enabled (which it is by default in most opencv builds), you can retrieve the mjpeg stream directly from the camera via FFMPEG. Something similar to the following (error checking omitted):
Code:
vc = cv2.VideoCapture()
vc.open('http://%s/mjpg/video.mjpg' % camera_host)
h = vc.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)
w = vc.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)
capture_buffer = np.empty(shape=(h, w, 3), dtype=np.uint8)
while True:
retval, img = vc.read(capture_buffer)