59 lines
1.9 KiB
Python
59 lines
1.9 KiB
Python
#!/usr/bin/env python
|
|
# -*- encoding: utf-8 -*-
|
|
'''
|
|
@File : api_debug.py
|
|
@Contact : zpyovo@hotmail.com
|
|
@License : (C)Copyright 2018-2019, Lab501-TransferLearning-SCUT
|
|
@Description :
|
|
|
|
@Modify Time @Author @Version @Desciption
|
|
------------ ------- -------- -----------
|
|
2023/8/26 17:55 Pengyu Zhang 1.0 None
|
|
'''
|
|
|
|
from __future__ import absolute_import
|
|
from __future__ import division
|
|
from __future__ import print_function
|
|
import requests
|
|
import cv2
|
|
import os
|
|
import json
|
|
import numpy as np
|
|
std_feature = os.path.join('/project/emblem_detection/tests/data/std_roi_encoding.json')
|
|
with open(std_feature, "r") as input_file:
|
|
loaded_data = json.load(input_file)
|
|
# 提取 qr_encoding 数据
|
|
std_feature_encoding = loaded_data['data']["roi_encoding"]
|
|
|
|
imagePath = "/project/emblem_detection/tests/data/1291182811394_pos_iPhone12Pro.jpg"
|
|
# imagePath = "/project/emblem_detection/tests/data/1291182811394_pos_LYA-AL00.jpg"
|
|
img = cv2.imread(imagePath)
|
|
imgfile = cv2.imencode('.jpg', img)[1]
|
|
files = { "file" : ('filename.jpg',imgfile, 'image/jpg')}
|
|
# form = {"threshold":'50',"angle":'45'}
|
|
form = {"threshold": '50', "std_roi_feature": json.dumps(std_feature_encoding)}
|
|
|
|
r = requests.post('http://localhost:6006/qr_roi_cloud_feature_comparison', files=files,
|
|
data=form).json()
|
|
|
|
print(r)
|
|
|
|
# r = requests.post('http://localhost:6006/qr_decode', files=files).json()
|
|
#
|
|
# print(r)
|
|
#
|
|
# r = requests.post('http://localhost:6006/dot_detection', files=files, data=form).json()
|
|
#
|
|
# print(r)
|
|
#
|
|
# r = requests.post('http://localhost:6006/dot_detection_top', files=files, data=form).json()
|
|
#
|
|
# print(r)
|
|
#
|
|
# r = requests.post('http://localhost:6006/dot_detection_bottom', files=files, data=form).json()
|
|
#
|
|
# print(r)
|
|
#
|
|
# r = requests.post('http://localhost:6006/qr_roi_cloud_feature_extraction', files=files).json()
|
|
#
|
|
# print(r['data']['status']) |