人脸注册
wb75075 发布于2017-07 浏览:3008 回复:5
0
收藏
快速回复

{"error_code":216402,"error_msg":"face not found","log_id":3749762415070820}

换了好多图片了,一直都是这个错误,找不到人脸?

收藏
点赞
0
个赞
共5条回复 最后由独孤焰坤回复于2018-01
#6独孤焰坤回复于2018-01

ios 中不需要转码~

0
#5小睿哥哥2016回复于2017-12

在iOS开发中,可以使用如下的方式来注册人脸API

- (void)signUpByFacePhoto:(UIImage *)image {

    ///http://ai.baidu.com/docs#/FACE-API/top

    

    NSURL *url = [NSURL URLWithString:@"https://aip.baidubce.com/rest/2.0/face/v2/faceset/user/add?access_token=24.48afaec56f491332f092314fbdd00fa6.2592000.1514881126.282335-10233570"];

    

    NSData *imageData = UIImagePNGRepresentation(image);

    NSString *base64Str = [imageData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];

    

    NSMutableDictionary *paramDict = [[NSMutableDictionary alloc] init];

    paramDict[@"uid"] = @"test_uid";

    paramDict[@"group_id"] = @"group_id";

    paramDict[@"user_info"] = @"user_info";

    paramDict[@"image"] = base64Str;

    

    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

    [manager POST:url.absoluteString parameters:paramDict progress:^(NSProgress * _Nonnull uploadProgress) {

        

        

    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {

            NSLog(@"%@", responseObject);

        

    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {

        

    }];

}

0
#4wb75075回复于2017-07

图片编码后,还要URL编码提交

0
#3wb75075回复于2017-07

这是注册的时候就报错了

0
#2chenxiaoyu3回复于2017-07

新人脸注册后需要稍等一段时间才能生效

0
TOP
切换版块