CV之API:利用Face++的人体识别接口,实现摄像头实时手势识别

测试图片

CV之API:利用Face++的人体识别接口,实现摄像头实时手势识别


实现代码(部分)

#利用Face++的人体识别接口,实现摄像头实时手势识别

import requests

from json import JSONDecoder

import datetime

import cv2

import os

http_url ="https://api-cn.faceplusplus.com/humanbodypp/beta/gesture"

key ="UVqp3_Es7_Gr504eGd0HQR4EWtvNC7u5"

secret ="PB5hI_ytmOkRIYXxEQEIwmbH0bFdqrL6"

filepath1 ="F:/Gesture5.jpg"

data = {"api_key":key, "api_secret": secret, "return_gesture": "1"}

files = {"image_file": open(filepath1, "rb")}

cap = cv2.VideoCapture(0)

while   True:

   ret, frame = cap.read()

 # cv2.resize(frame,frame,320,240,0)

   # show a frame

   cv2.imshow("capture", frame)

   cv2.imwrite(filepath1, frame)

   files = {"image_file": open(filepath1, "rb")}

   starttime = datetime.datetime.now()

   response = requests.post(http_url, data=data, files=files)

   endtime = datetime.datetime.now()

   print((endtime - starttime).seconds)

   req_con = response.content.decode('utf-8')

   req_dict = JSONDecoder().decode(req_con)

   print(req_dict)

   cv2.waitKey(10)


上一篇:webluker刷新缓存-php版


下一篇:asp.net Jquery图片延迟加载