• 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");
     
  • 相关阅读:
    您真的了解javaScript?(3)
    SvUDID实现设备唯一标示
    iOS 获取通讯录权限的时机
    iOS 后台退出app时不执行applicationWillTerminate的临时解决方法
    sqlite 批量插入, 重复插入(更新)
    tableView 显示区域偏移
    socket 粘包问题(转)
    ruby 安装更新
    openssl 升级
    gem 安装&卸载pod
  • 原文地址:https://www.cnblogs.com/Anita9002/p/4057128.html
Copyright © 2020-2023  润新知