首页 版块 积分商城 访问AI主站 注册 发帖
小睿哥哥2016
21
积分 积分商城
0
获赞
人脸注册接口提示 face not found
Ta的回复 :为什么iOS的swift语言的图片64位编码,总是不对 ```     func base64ToString() -> String? {         let imageData = UIImagePNGRepresentation(self)         if let _imageData = imageData {             return _imageData.base64EncodedString(options: NSData.Base64EncodingOptions.lineLength64Characters)         }         return nil     } ```
6
人脸注册接口提示 face not found
Ta的回复 :在iOS的Objective-C语言中,可以使用如下代码,来注册人脸 - (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=你的access_token"];     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) {     }]; }
6
人脸注册
Ta的回复 :在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) {              }]; }
5
切换版块
智能客服