app.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:StreamMotionDetection 作者: henry54809 项目源码 文件源码
def get_mjpeg_stream_image(stream):
    global bytes
    while True:
        bytes += stream.read(20000)
        a = bytes.find(b'\xff\xd8')
        b = bytes.find(b'\xff\xd9')
        if a!= -1 and b != -1:
             jpg = bytes[a:b+2]
             bytes = bytes[b+2:]
             img = cv2.imdecode(np.fromstring(jpg, dtype=np.uint8), cv2.IMREAD_COLOR)
             q.put_nowait(img)
        cv2.waitKey(1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号