fire1 bug

This commit is contained in:
曹前明 2022-09-11 17:03:55 +08:00
parent 2e2abebd3b
commit ddce16a893
1 changed files with 5 additions and 9 deletions

View File

@ -46,14 +46,14 @@ def fire1(ip: str, pic_url: str):
# 未配置灭火器事件
channel = grpc.insecure_channel(ip+':2001')
stub = BeiHangGrpc_pb2_grpc.Fire_RegStub(channel)
image_id = 3
image_id = 3
img_name = '{}.png'.format(uuid.uuid4())
img_path = settings.BASE_DIR + '/temp/' + img_name
with open(img_path, "wb") as f:
f.write(requests.get(url=pic_url, verify=False).content).read())
f.write(requests.get(url=pic_url, verify=False).content)
img = cv2.imread(img_path)
resized_img = cv2.resize(img, None, fx=0.25,fy=0.25)
resized_img = cv2.imencode('.png',resized_img)[1]
resized_img = cv2.resize(img, None, fx=0.25, fy=0.25)
resized_img = cv2.imencode('.png', resized_img)[1]
image_base64 = str(base64.b64encode(resized_img))[2:-1]
request = BeiHangGrpc_pb2.JinYu_Request(zzid=image_id, imgsbase64=image_base64)
@ -65,10 +65,6 @@ def fire1(ip: str, pic_url: str):
return True, response
if __name__ == "__main__":
path = 'http://10.99.5.24/evo-apigw/evo-oss/6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_3de82501-2521-11ed-884a-e4246c7d1635_7236037_7245601.jpg?token=399773e6-71f7-4202-b234-ff5aa8d2492c'
base64img = str(base64.b64encode(BytesIO(requests.get(url=path, verify=False).content).read()), 'utf-8')