__init__.py 文件源码

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

项目:Sommarprojekt16 作者: fregu856 项目源码 文件源码
def gen_normal():
    while 1:
        if len(latest_video_frame) > 0: # if we have started receiving actual frames:
            # convert the latest read video frame to jpg format:
            ret, jpg = cv2.imencode(".jpg", latest_video_frame) 

            # get the raw data bytes of the jpg image: (convert to binary)
            frame = jpg.tobytes()

            # yield ('return') the frame: (yield: returns value and saves the current state of the generator function, the next time this generator function is called execution will resume on the next line of code in the function (ie it will in this example start a new cycle of the while loop and yield a new frame))
            # what we yield looks like this, but in binary: (binary data is a must for multipart)
            # --frame
            # Content-Type: image/jpeg
            #
            # <frame data>
            #
            yield (b'--frame\nContent-Type: image/jpeg\n\n' + frame + b'\n')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号