1
- # tencentyun-youtu-java
1
+ # tencentyun-youtu-python
2
2
3
- java sdk for [ 腾讯云智能优图服务] ( http://www.qcloud.com/product/fr.html ) & [ 腾讯优图开放平台] ( http://open.youtu.qq.com )
3
+ python sdk for [ 腾讯云智能优图服务] ( http://www.qcloud.com/product/fr.html ) & [ 腾讯优图开放平台] ( http://open.youtu.qq.com )
4
4
5
5
## 安装
6
6
7
+ ####依赖项
8
+ ```
9
+ - Requests,获取更新版本
10
+ http://docs.python-requests.org/en/latest/
11
+ ```
7
12
####构建工程
8
13
```
9
- 1. 下载sdk到您的目录
10
- git clone https://github.com/TencentYouTu/java_sdk.git
11
- 2. 在你的项目里引入本项目dist目录下的json.jar和youtu-java-sdk.jar包或者直接引入源码.
12
- 3. 导入包并创建Youtu对象,然后调用相应方法.
14
+ 1. 下载sdk到您的目录${python_sdk}
15
+ git clone https://github.com/TencentYouTu/python_sdk.git
16
+ 2. 在您需要使用sdk的文件中import TencentYoutuyun包
13
17
```
14
18
15
19
## 名词
@@ -22,141 +26,131 @@ java sdk for [腾讯云智能优图服务](http://www.qcloud.com/product/fr.html
22
26
23
27
## 使用示例
24
28
```
25
- import org.json.JSONObject;
26
- import com.youtu.*;
27
- // 请把下面的APP_ID、SECRET_ID和SECRET_KEY换成你自己的数据,下面的数据已经不可用
28
- public static final String APP_ID = "1000234";
29
- public static final String SECRET_ID = "AKIDUIsdfDlPDt5mZutfr46sdNT0GisFcQh1nMOox";
30
- public static final String SECRET_KEY = "ind5yAd55ZspBc7MCANcxsdEjuXi8YU8RL";
31
-
32
- Youtu faceYoutu = new Youtu(APP_ID, SECRET_ID, SECRET_KEY);
33
- JSONObject respose = faceYoutu.DetectFace("test.jpg");
34
- //get respose
35
- System.out.println(respose);
36
- //get detail info
37
- if(respose.getInt("errorcode")==0){
38
- System.out.println(respose.get("image_height"));
39
- System.out.println(respose.get("face"));
40
- System.out.println(respose.getJSONArray("face").getJSONObject(0).get("yaw"));
41
- System.out.println(respose.getInt("errorcode"));
42
- System.out.println(respose.get("errormsg"));
43
- }
29
+ # -*- coding: utf-8 -*-
30
+
31
+ import time
32
+ import TencentYoutuyun
33
+
34
+ appid = '105054'
35
+ secret_id = 'J9I1LNj5Wdr8TxI2VyWai3Ziz5TiZ2vZsp'
36
+ secret_key = 'J9I1LNjWdr8TxI2VyWai3ZizTiZ2vZsp'
37
+
38
+ youtu = TencentYoutuyun.YouTu(appid, secret_id, secret_key)
39
+
40
+ ret = youtu.FaceCompare('you_path_one.jpg','you_path_two.jpg')
41
+ print ret
44
42
```
45
43
46
44
##初始化
47
45
- 示例
48
- - ` Youtu faceYoutu = new Youtu (appid, secret_id, secret_key); `
46
+ - ` youtu = TencentYoutuyun.YouTu (appid, secret_id, secret_key)`
49
47
50
- - 参数
48
+ - 参数` ytopen_sdk::AppSign `
51
49
- `appid` 业务中的应用标识AppId
52
50
- `secret_id` 秘钥SecretId
53
51
- `secret_key` 秘钥SecretKey
54
52
55
53
##接口说明
56
54
接口调用统一返回值说明
57
- - 返回值 ` JSONObject `
55
+ - 返回值
58
56
`Json`格式的返回结果,具体字段参考API文档
59
-
57
+
60
58
###人脸检测
61
59
- 接口
62
- ` JSONObject DetectFace(String image_path,int mode) `
63
- - 参数
64
- - `image_path` 待检测的图片路径
65
- - `mode` 是否大脸模式,默认非大脸模式
66
-
67
- ###人脸配准
68
- - 接口
69
- ` JSONObject FaceShape(String image_path,int mode) `
60
+ ` DetectFace(self, image, mode = 0) `
70
61
- 参数
71
- - `image_path ` 待检测的图片路径
62
+ - `image ` 待检测的图片路径
72
63
- `mode` 是否大脸模式,默认非大脸模式
73
64
74
65
###人脸比对
75
66
- 接口
76
- ` JSONObject FaceCompare(String image_path_a, String image_path_b) `
67
+ ` FaceCompare(self, imageA, imageB): `
77
68
- 参数
78
- - `image_path_a` 待比对的A图片数据,base64编码
79
- - `image_path_b` 待比对的B图片数据,base64编码
69
+ - `imageA` 待比对的A图片路径
70
+ - `imageB` 待比对的B图片路径
80
71
81
72
###人脸验证
82
73
- 接口
83
- ` JSONObject FaceVerify(String image_path, String person_id)`
74
+ ` FaceVerify(self, person_id, image ) `
84
75
- 参数
85
76
- `person_id` 待验证的人脸id
86
- - `image_path` 待验证的图片数据路径
77
+ - `image` 待验证的图片路径
87
78
88
79
###人脸识别
89
80
- 接口
90
- ` JSONObject FaceIdentify(String image_path, String group_id)`
81
+ ` FaceIdentify(self, group_id, image ) `
91
82
- 参数
92
- - `group_id` 待识别的组id
93
- - `image_path` 待识别的图片数据路径
83
+ - `group_id` 识别的组id
84
+ - `image` 待识别的图片路径
94
85
95
86
###新建个体
96
87
- 接口
97
- ` JSONObject NewPerson(String image_path, String person_id, List<String> group_ids)`
88
+ ` NewPerson(self, person_id, image, group_ids, person_name= '', tag='' ) `
98
89
- 参数
99
90
- `person_id` 新建的个体id,用户指定,需要保证app_id下的唯一性
100
- - `person_name` 新建的个体名称
101
- - `group_ids` 新建的个体存放的组id,可以指定多个组id, 用户指定(组默认创建)
102
- - `image_path ` 包含个体人脸的图片路径
91
+ - `person_name` 待验证的图片数据
92
+ - `group_ids` 数组类型, 用户指定(组默认创建)的个体存放的组id,可以指定多个组id
93
+ - `image ` 包含个体人脸的图片路径
103
94
- `tag` 备注信息,用户自解释字段
104
95
105
96
###删除个体
106
97
- 接口
107
- ` JSONObject DelPerson(String person_id)`
98
+ ` DelPerson(self, person_id) `
108
99
- 参数
109
100
- `person_id` 待删除的个体id
110
101
111
102
###增加人脸
112
103
- 接口
113
- ` JSONObject AddFace(String person_id, List<String> image_path_arr )`
104
+ ` AddFace(self, person_id, images, tag='' ) `
114
105
- 参数
115
106
- `person_id` 新增人脸的个体身份id
116
- - `image_path_arr` 待增加的包含人脸的图片数据的路径,可加入多张(总包体大小<2m)
107
+ - `images` 数组类型,待增加的包含人脸的图片路径,可加入多张(包体大小<2m)
108
+ - `tag` 人脸备注信息,用户自解释字段
117
109
118
110
###删除人脸
119
111
- 接口
120
- ` JSONObject DelFace(String person_id, List<String> face_id_arr )`
112
+ ` DelFace(self, person_id, face_ids ) `
121
113
- 参数
122
114
- `person_id` 待删除人脸的个体身份id
123
- - `face_id_arr` 待删除的人脸id集合
115
+ - `face_ids` 数组类型,待删除的人脸id
124
116
125
117
###获取信息
126
118
- 接口
127
- ` JSONObject GetInfo(String person_id)`
119
+ ` GetInfo(self, person_id) `
128
120
- 参数
129
121
- `person_id` 待查询的个体身份id
130
122
131
123
###设置信息
132
124
- 接口
133
- ` JSONObject SetInfo(String person_name, String person_id )`
125
+ ` SetInfo(self, person_id, person_name='', tag='' ) `
134
126
- 参数
135
127
- `person_id` 待设置的个体身份id
136
- - `person_name` 新设置的个体名字
128
+ - `person_name` 新设置的个体名字,为空无效
129
+ - `tag` 新设置的人脸备注信息,为空无效
137
130
138
131
###获取组列表
139
132
- 接口
140
- ` JSONObject GetGroupIds()`
133
+ ` GetGroupIds(self ) `
141
134
- 参数
142
135
- 无
136
+
143
137
###获取个体列表
144
138
- 接口
145
- ` JSONObject GetPersonIds(String group_id)`
139
+ ` GetPersonIds(self, group_id) `
146
140
- 参数
147
141
- `group_id` 待查询的组id
148
142
149
143
###获取人脸列表
150
144
- 接口
151
- ` JSONObject GetFaceIds(String person_id)`
145
+ ` GetFaceIds(self, person_id) `
152
146
- 参数
153
147
- `person_id` 待查询的个体id
154
148
155
149
###获取人脸信息
156
150
- 接口
157
- ` JSONObject GetFaceInfo(String face_id)`
151
+ ` GetFaceInfo(self, face_id) `
158
152
- 参数
159
- - `face_id` 待查询人脸的id
153
+ - `face_id` 待查询的人脸id
160
154
161
155
```
162
156
```
0 commit comments