DetectFace可以根据输入图片,检测出图片中的人脸并给出每张人脸定位和关键点信息。

图片限制

  • 请求格式:JPEG、JPG、PNG、BMP。
  • 图像大小:图像大小小于等于3M。
  • 图像分辨率:图片大小要求5*5像素以上。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String DetectFace

系统规定参数。取值:DetectFace。

ImageURL String https://viapi-demo.oss-cn-shanghai.aliyuncs.com/viapi-demo/images/DetectImageElements/detect-elements-src.png

图片url地址(http/https)。

返回数据

名称 类型 示例值 描述
RequestId String D6C24839-91A7-41DA-B31F-98F08EF80CC0

当前请求的request id。

Data Struct

返回的数据内容。

FaceCount Integer 1

检测出来的人脸个数。

LandmarkCount Integer 105

特征点数目,目前固定为105点(顺序:眉毛24点,眼睛32点,鼻子6点,嘴巴34点,外轮廓9点)。

FaceRectangles List 265

返回人脸矩形框,分别是[left, top, width, height]。如有多个人脸,则依次顺延,返回矩形框。例如有两个人脸则返回[left1, top1, width1, height1, left2, top2, width2, height2]

FaceProbabilityList List 1.0

返回人脸概率,取值范围0~1。如有多个人脸,则依次顺延。如有两个人脸则返回[face_prob1, face_prob2]

PoseList List 24.281335830688477

返回人脸姿态[yaw, pitch, roll]

  • yaw为左右角度,取值[-90,90]
  • pitch为上下角度,取值[-90,90]
  • roll为平面旋转角度,取值[-180,180]

如有多个人脸,则依次顺延。

Landmarks List 281.339599609375

特征点定位结果,每个人脸返回一组特征点位置,表示方式为(x0, y0, x1, y1, ……);如有多个人脸,则依次顺延,返回定位浮点数。

Pupils List 301.26824951171875

左右两个瞳孔的中心点坐标和半径,每个人脸6个浮点数,顺序是[left_iris_cenpt.x, left_iris_cenpt.y, left_iris_radius, right_iris_cenpt.x, right_iris_cenpt.y, right_iris_radis]

示例

请求示例

https://facebody.cn-shanghai.aliyuncs.com/?Action=DetectFace&<公共请求参数>

正常返回示例

JSON 格式

{
  "RequestId": "D6C24839-91A7-41DA-B31F-98F08EF80CC0",
  "Data": {
    "FaceCount": 1,
    "LandmarkCount": 105,
    "FaceProbabilityList": [
      1.0
    ],
    "FaceRectangles": [
      265,
      71,
      87,
      125
    ],
    "Pupils": [
      301.26824951171875,
      116.69911956787109,
      3.2958550453186035,
      337.1932373046875,
      117.36859130859375,
      3.2958550453186035
    ],
    "Landmarks": [
      281.339599609375,
      111.74824523925781,
      316.814453125,
      109.33021545410156,
      298.70803833007812,
      100.61702728271484,
      298.88302612304688,
      108.060791015625,
      285.1934814453125,
      105.57911682128906,
      291.51913452148438,
      101.93890380859375,
      306.01254272460938,
      100.83401489257812,
      312.91998291015625,
      103.20404815673828,
      287.27627563476562,
      110.86068725585938,
      292.93121337890625,
      108.84946441650391,
      304.88528442382812,
      107.96066284179688,
      310.84051513671875,
      108.72686004638672,
      326.04830932617188,
      110.23492431640625,
      349.82394409179688,
      116.47871398925781,
      339.974365234375,
      103.33187866210938,
      338.83309936523438,
      110.10500335693359,
      328.7598876953125,
      105.13726043701172,
      334.20297241210938,
      103.10139465332031,
      344.99005126953125,
      106.10746765136719,
      348.31561279296875,
      110.83525848388672,
      330.33255004882812,
      110.15277099609375,
      334.57919311523438,
      109.64480590820312,
      342.86285400390625,
      111.47510528564453,
      346.29779052734375,
      114.04013824462891,
      291.74725341796875,
      117.73886108398438,
      308.77789306640625,
      119.03263854980469,
      293.69647216796875,
      116.22122192382812,
      295.8997802734375,
      115.1051025390625,
      298.25656127929688,
      114.37227630615234,
      300.71987915039062,
      114.21405792236328,
      303.15951538085938,
      114.59332275390625,
      305.46673583984375,
      115.46703338623047,
      307.43136596679688,
      116.96055603027344,
      293.73956298828125,
      118.59514617919922,
      295.87588500976562,
      118.95455932617188,
      298.03317260742188,
      119.17375183105469,
      300.1884765625,
      119.41287231445312,
      302.35617065429688,
      119.46455383300781,
      304.5201416015625,
      119.60442352294922,
      306.68862915039062,
      119.61016845703125,
      331.28890991210938,
      119.46241760253906,
      347.22207641601562,
      120.0771484375,
      332.89697265625,
      117.79374694824219,
      334.875732421875,
      116.58906555175781,
      337.09341430664062,
      115.91836547851562,
      339.396240234375,
      115.69750213623047,
      341.67678833007812,
      116.09440612792969,
      343.7935791015625,
      117.03681182861328,
      345.73513793945312,
      118.29764556884766,
      333.2418212890625,
      119.90894317626953,
      335.24517822265625,
      119.96858215332031,
      337.24945068359375,
      119.96987915039062,
      339.25311279296875,
      120.01873016357422,
      341.2572021484375,
      120.04513549804688,
      343.25360107421875,
      120.21870422363281,
      345.2501220703125,
      120.394775390625,
      321.70758056640625,
      120.6357421875,
      329.55029296875,
      137.04385375976562,
      325.57427978515625,
      128.84083557128906,
      326.6263427734375,
      143.497802734375,
      311.70217895507812,
      142.082763671875,
      336.76617431640625,
      141.73812866210938,
      299.3594970703125,
      158.21333312988281,
      337.82550048828125,
      161.95458984375,
      299.66818237304688,
      158.5447998046875,
      335.92446899414062,
      161.60453796386719,
      325.49420166015625,
      152.57087707519531,
      321.367919921875,
      151.66354370117188,
      329.08807373046875,
      152.33145141601562,
      310.1392822265625,
      154.20761108398438,
      335.1060791015625,
      155.65093994140625,
      304.6243896484375,
      155.87655639648438,
      315.69949340820312,
      152.69769287109375,
      332.400146484375,
      153.43692016601562,
      337.06048583984375,
      158.54299926757812,
      324.14389038085938,
      172.388916015625,
      310.353515625,
      167.7384033203125,
      333.07455444335938,
      169.97897338867188,
      304.37698364257812,
      163.52882385253906,
      317.01605224609375,
      170.74409484863281,
      328.84054565429688,
      172.00675964355469,
      335.95611572265625,
      166.27621459960938,
      325.1163330078125,
      156.05825805664062,
      324.6710205078125,
      168.06950378417969,
      312.29644775390625,
      156.13916015625,
      311.5223388671875,
      164.95767211914062,
      331.5244140625,
      156.99411010742188,
      331.53219604492188,
      166.85432434082031,
      305.93841552734375,
      157.11126708984375,
      305.32623291015625,
      162.2498779296875,
      318.70394897460938,
      155.58462524414062,
      318.026123046875,
      166.81254577636719,
      328.386474609375,
      156.07386779785156,
      328.1087646484375,
      167.50234985351562,
      334.23138427734375,
      158.80679321289062,
      334.18035888671875,
      164.619384765625,
      254.07440185546875,
      124.59323883056641,
      348.11810302734375,
      122.94961547851562,
      326.1951904296875,
      196.3538818359375,
      272.02932739257812,
      176.8316650390625,
      348.34765625,
      161.67092895507812,
      259.41159057617188,
      150.87774658203125,
      350.79559326171875,
      142.18373107910156,
      299.49493408203125,
      192.26150512695312,
      340.1668701171875,
      180.7928466796875
    ],
    "PoseList": [
      24.281335830688477,
      7.5478448867797852,
      -4.5344352722167969
    ]
  }
}

错误码

具体请参见常见错误码