def send_image(s, im, scale=1.0, encode_param=[int(cv2.IMWRITE_JPEG_QUALITY),90]):
# Will not upsample image for bandwidth reasons
if scale < 1:
im = cv2.resize(im, None, fx=scale, fy=scale)
result, imgencode = cv2.imencode('.jpg', im, encode_param)
data = np.array(imgencode)
stringData = data.tostring()
s.send( str(len(stringData)).ljust(16))
s.send( stringData )
评论列表
文章目录