手部关键点识别
更新时间:2022-01-18
手部关键点识别
对于输入的一张图片(可正常解码,且长宽比适宜),检测图片中的手部,输出每只手的坐标框、21个骨节点坐标信息。
当前接口主要适用于图片中单个手部的情况,图片中同时存在多个手部时,识别效果可能欠佳。
public void sample(AipBodyAnalysis client) {
    // 传入可选参数调用接口
    HashMap<String, String> options = new HashMap<String, String>();
    
    
    // 参数为本地路径
    String image = "test.jpg";
    JSONObject res = client.handAnalysis(image, options);
    System.out.println(res.toString(2));
    // 参数为二进制数组
    byte[] file = readFile("test.jpg");
    res = client.handAnalysis(file, options);
    System.out.println(res.toString(2));
}手部关键点识别 请求参数详情
| 参数名称 | 是否必选 | 类型 | 说明 | 
|---|---|---|---|
| image | 是 | mixed | 本地图片路径或者图片二进制数据 | 
手部关键点识别 返回数据参数详情
| 字段 | 是否必选 | 类型 | 说明 | 
|---|---|---|---|
| hand_num | 是 | uint32 | 检测到的人手数目 | 
| hand_info | 否 | object[] | 手部关节点信息 | 
| +location | 否 | object | 手部坐标信息 | 
| ++left | 否 | int | 手部区域离左边界的距离 | 
| ++top | 否 | int | 手部区域离上边界的距离 | 
| ++width | 否 | int | 手部区域的宽度 | 
| ++height | 否 | int | 手部区域的高度 | 
| +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 | 置信度分数 | 
手部关键点识别 返回示例
返回关键点对应位置示意图:
{
  "log_id": "46532731~~~~32348525916",
  "hand_num": 1,
  "hand_info": [
    {
      "hand_parts": {
        "0": {
          "y": 707,
          "x": 829,
          "score": 0.81601244211197
        },
        "1": {
          "y": 620,
          "x": 873,
          "score": 0.6850221157074
        },
        "2": {
          "y": 533,
          "x": 916,
          "score": 0.75532239675522
        },
        "3": {
          "y": 467,
          "x": 938,
          "score": 0.79282909631729
        },
        "4": {
          "y": 380,
          "x": 993,
          "score": 0.88114696741104
        },
        "5": {
          "y": 424,
          "x": 829,
          "score": 0.90723776817322
        },
        "6": {
          "y": 358,
          "x": 862,
          "score": 0.62833058834076
        },
        "7": {
          "y": 391,
          "x": 916,
          "score": 0.77525424957275
        },
        "8": {
          "y": 456,
          "x": 927,
          "score": 0.87964057922363
        },
        "9": {
          "y": 402,
          "x": 775,
          "score": 0.91389346122742
        },
        "10": {
          "y": 325,
          "x": 786,
          "score": 0.85947573184967
        },
        "11": {
          "y": 249,
          "x": 818,
          "score": 0.88918441534042
        },
        "12": {
          "y": 151,
          "x": 840,
          "score": 0.85277211666107
        },
        "13": {
          "y": 424,
          "x": 720,
          "score": 0.81941932439804
        },
        "14": {
          "y": 347,
          "x": 720,
          "score": 0.83918035030365
        },
        "15": {
          "y": 282,
          "x": 720,
          "score": 0.84135395288467
        },
        "16": {
          "y": 194,
          "x": 731,
          "score": 0.85115605592728
        },
        "17": {
          "y": 489,
          "x": 687,
          "score": 0.84704375267029
        },
        "18": {
          "y": 434,
          "x": 644,
          "score": 0.88782823085785
        },
        "19": {
          "y": 391,
          "x": 622,
          "score": 0.86267304420471
        },
        "20": {
          "y": 325,
          "x": 567,
          "score": 0.91110396385193
        }
      },~~~~
      "location": {
        "height": 556,
        "width": 426,
        "top": 151,
        "score": 17.495880126953,
        "left": 567
      }
    }
  ]
}