Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (18 sloc) 0.69 kb
"""
Created on Feb 9, 2013
@author: sgoldsmith
Copyright (c) Steven P. Goldsmith
All rights reserved.
"""
import io, numpy, cv2, Image, MjpegFramePluginBase
class MjpegPilFramePlugin(MjpegFramePluginBase.MjpegFramePluginBase):
"""PIL based frame grabber
If you see 'Invalid SOS parameters for sequential JPEG' errors from
cvpframe.MjpegRawFramePlugin then use this plugin.
"""
def getFrame(self):
# Get raw frame.
return self.getFrameRaw()
def decodeFrame(self, image):
# Convert PIL Image format to something OpenCV understands.
return cv2.cvtColor(numpy.array(Image.open(io.BytesIO(image))), cv2.COLOR_RGB2BGR)
Jump to Line
Something went wrong with that request. Please try again.