有幸获得百度人体分析-手部关键点内测名额,现分享api示例
function request_post($url = '', $param = '') { if (empty($url) || empty($param)) { return false; } $postUrl = $url; $curlPost = $param; // 初始化curl $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $postUrl); curl_setopt($curl, CURLOPT_HEADER, 0); // 要求结果为字符串且输出到屏幕上 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // post提交方式 curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost); // 运行curl $data = curl_exec($curl); curl_close($curl); return $data; } $url = 'https://aip.baidubce.com/oauth/2.0/token'; $post_data['grant_type'] = 'client_credentials'; $post_data['client_id'] = 'client_id'; $post_data['client_secret'] = 'client_secret'; $o = ""; foreach ( $post_data as $k => $v ) { $o.= "$k=" . urlencode( $v ). "&" ; } $post_data = substr($o,0,-1); $json = $this->request_post($url, $post_data); $token = json_decode($json,true); $token = $token['access_token']; $url = 'https://aip.baidubce.com/rest/2.0/image-classify/v1/hand_analysis?access_token=' . $token; $name=IA_ROOT.'/addons/xigua_aimian/avatar/11.jpg'; $img = file_get_contents($name); $img = base64_encode($img); $bodys = array( 'image' => $img, 'image_type' => 'BASE64' ); $res = $this->request_post($url, $bodys); var_dump($res);
**返回参数**
| 字段 | 是否必选 | 类型 | 说明 |
| ----------- | ---- | -------- | ---------------- |
| hand_num | 是 | uint32 | 人手数目 |
| hand_info | 是 | object[] | 手部关节点信息 |
| +hand_parts | 是 | object | 手部骨节点信息,包含21个关键点 |
| ++0 | 是 | object | 关键点的标签,0-20 |
| +++x | 是 | uint32 | x坐标 |
| +++y | 是 | uint32 | y坐标 |
| +++score | 是 | float | 置信度分数 |
| | | | |
| ++20 | 是 | object | 第20号关键点 |
| +++x | 是 | uint32 | x坐标 |
| +++y | 是 | uint32 | y坐标 |
| +++score | 是 | float | 置信度分数 |
| +location | 是 | object | 手部坐标信息 |
| ++height | 是 | float | 手部区域的高度 |
| ++left | 是 | float | 手部区域离左边界的距离 |
| ++top | 是 | float | 手部区域离上边界的距离 |
| ++width | 是 | float | 手部区域的宽度 |
| log_id | 是 | uint64 | 唯一的log id,用于问题定位 |
本人作用是识别手部五指,经过测试识别精度高速度快完全满足应用需求,再次感谢百度相关工作人员
请登录后评论
TOP
切换版块
不错,如果速度能跟上,可以做一些有意思的应用
有没有人体关键点结合手部关键点的案例啊
还可以吧
手相还要看线呢
向楼主学习。
手部识别这么多点
这个真的可以用于看手相
感觉可以用来看手相了。。。这么丰富的关键点
图片手工标注,不是百分之百准备,仅供参考