FACE++学习一、detect接口

/detection/detect

描述

检测给定图片(Image)中的所有人脸(Face)的位置和相应的面部属性

  • 目前面部属性包括性别(gender), 年龄(age), 种族(race), 微笑程度(smiling), 眼镜(glass)和姿势(pose)
若结果的face_id没有被加入任何faceset/person之中,则在72小时之后过期被自动清除。
参数:
 
 
 
 
 
JSON构成:
{
    "face": [
        {
            "attribute": {
                "age": {
                    "range": 5, 
                    "value": 23
                }, 
                "gender": {
                    "confidence": 99.9999, 
                    "value": "Female"
                }, 
                "glass": {
                    "confidence": 99.945, 
                    "value": "None"
                }, 
                "pose": {
                    "pitch_angle": {
                        "value": 17
                    }, 
                    "roll_angle": {
                        "value": 0.735735
                    }, 
                    "yaw_angle": {
                        "value": -2
                    }
                }, 
                "race": {
                    "confidence": 99.6121, 
                    "value": "Asian"
                }, 
                "smiling": {
                    "value": 4.86501
                }
            }, 
            "face_id": "17233b4b1b51ac91e391e5afe130eb78", 
            "position": {
                "center": {
                    "x": 49.4, 
                    "y": 37.6
                }, 
                "eye_left": {
                    "x": 43.3692, 
                    "y": 30.8192
                }, 
                "eye_right": {
                    "x": 56.5606, 
                    "y": 30.9886
                }, 
                "height": 26.8, 
                "mouth_left": {
                    "x": 46.1326, 
                    "y": 44.9468
                }, 
                "mouth_right": {
                    "x": 54.2592, 
                    "y": 44.6282
                }, 
                "nose": {
                    "x": 49.9404, 
                    "y": 38.8484
                }, 
                "width": 26.8
            }, 
            "tag": ""
        }
    ], 
    "img_height": 500, 
    "img_id": "22fd9efc64c87e00224c33dd8718eec7", 
    "img_width": 500, 
    "session_id": "38047ad0f0b34c7e8c6efb6ba39ed355", 
    "url": "http://www.faceplusplus.com.cn/wp-content/themes/faceplusplus/assets/img/demo/1.jpg?v=4"
}

 JSON调用格式:

 final float ag ;
                            final String ger;
                            float x, y, w, h;
                            int i = 0;
                            //get the center point
                            x = (float)rst.getJSONArray("face").getJSONObject(i)
                                    .getJSONObject("position").getJSONObject("center").getDouble("x");
                            y = (float)rst.getJSONArray("face").getJSONObject(i)
                                    .getJSONObject("position").getJSONObject("center").getDouble("y");

                            //get face size
                            w = (float)rst.getJSONArray("face").getJSONObject(i)
                                    .getJSONObject("position").getDouble("width");
                            h = (float)rst.getJSONArray("face").getJSONObject(i)
                                    .getJSONObject("position").getDouble("height");
                            
                            //get face age
                            ag = (float)rst.getJSONArray("face").getJSONObject(i)
                            .getJSONObject("attribute").getJSONObject("age").getInt("value");
                            
                            // get face gender
                            
                            ger = (String)rst.getJSONArray("face").getJSONObject(i)
                                    .getJSONObject("attribute").getJSONObject("gender").getString("value");

 

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值