python调用Face++,玩坏了!
来源:互联网 发布:linux 设置目录权限 编辑:程序博客网 时间:2024/05/01 05:54
看到一句话,如果你写代码没有写诗一样的感觉,那你不适合做程序猿!
还是直接上代码吧:
import requestsfrom json import JSONDecoderimport cv2import oshttp_url ="https://api-cn.faceplusplus.com/facepp/v3/detect"# your key and your secret,急用的话,可以加微信lp9628。key ="***"secret ="***" filename = '/Users/liupeng/Desktop/anaconda/widerface/WIDER_train/images'for filename1 in os.listdir(filename): print filename1 if (filename1[0] != '.'): filename1 = filename + '/' + filename1 for filename2 in os.listdir(filename1): print filename2 if (filename2[0] != '.'): filename2 = filename1 + '/' + filename2 filepath = filename2 data = {"api_key":key, "api_secret":secret, "return_landmark":"1"} files = {"image_file":open(filepath, "rb")} response = requests.post(http_url, data=data, files=files) req_con = response.content.decode('utf-8') req_dict = JSONDecoder().decode(req_con) print (len(req_dict[u'faces'])) face_num = len(req_dict[u'faces']) frame = cv2.imread(filepath) for i in range(face_num): box = req_dict[u'faces'][i][u'face_rectangle'] print(box) x, y, w, h = box[u'left'], box[u'top'],box[u'width'],box[u'height'] color = (0, 255, 0) cv2.rectangle(frame, (x, y), (x + w, y + h), color, 2) #显示图像 cv2.imshow("faceDetecion", frame) c = cv2.waitKey(10)cv2.destroyAllWindows()
如果帮到你了,请赞赏支持:
阅读全文
0 0
- python调用Face++,玩坏了!
- 玩坏iPhone Face ID全面指南
- CentOS6.5:升级了python,把输入法给玩坏了
- 被“玩坏”了的打车软件
- 玩坏了的深度学习
- [python]pip坏了怎么办?
- 人工智能不仅玩坏了一只猫,还玩坏了整个简笔画
- Python调用Face++人脸检测API
- ZOJ2112 & BZOJ1901 玩坏了的主席树
- 被自动装箱玩坏了,求大神指导
- 小玩了下python
- 我的Linux历险记-在终于玩坏了一个系统之后的总结
- 别这样啊,扉页献词都被你们玩坏了!
- android 更新sdk 把eclipse 玩坏了,重新安装经验 (android)
- 一定要玩坏这个blog^-^
- Face++ API调用
- python3.5调用face++
- python opencv face detection
- HBuilder mui 入门教程——(3)页面传值
- 单片机时钟程序(11)timing.h
- 算法概论 8.8习题证明
- 训练一周总结
- Shell脚本:人机交互脚本-scp
- python调用Face++,玩坏了!
- eclipse中java项目的build path详解
- UDT源码剖析(四):UDT的GC线程相关过程代码注释
- [LeetCode 解题报告]011.Container With Most Water
- Codeforces 282E Sausage Maximization【字典树+贪心】
- HBase 常用Shell命令
- Spark在不同集群中的运行架构
- MySQL安装applying security settings错误解决方案
- MongoDB