def dispact_and_update(img, hack, base_im, x, y, w, h):
try:
myurl = "http://facejack.westeurope.cloudapp.azure.com:5001/imsend"
headers = {
'content-type': "application/x-www-form-urlencoded",
'cache-control': "no-cache"
}
r = requests.post(url=myurl, data=img, headers=headers, params={'hack': str(hack)}).json()
reply = 'authentication' in r and r['authentication'] == "ALLOWED"
disp_face = cv2.resize(base_im[y:y + h, x:x + w], (224, 224), 0, 0, cv2.INTER_LANCZOS4)
if reply:
cv2.rectangle(disp_face, (0, 0), (222, 222), (0, 255, 0), 2)
else:
cv2.rectangle(disp_face, (0, 0), (222, 222), (0, 0, 255), 2)
cv2.imshow("Face", disp_face)
finally:
myl.release()
评论列表
文章目录