webcam.py 文件源码

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

项目:ssd_tensorflow 作者: seann999 项目源码 文件源码
def start_stream(self):
        bytes = None

        print("starting stream...")
        stream = urllib2.urlopen(self.address) #'http://192.168.100.102:8080/video'
        bytes = b''

        while True:
            bytes += stream.read(1024)
            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:]
                self.image = cv2.cvtColor(cv2.imdecode(np.fromstring(jpg, dtype=np.uint8), cv2.IMREAD_COLOR), cv2.COLOR_BGR2RGB)
                #cv2.imshow('i', self.image)
                #cv2.waitKey(1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号