tencentyun-youtu c++ sdk for 腾讯云智能优图服务 & 腾讯优图开放平台 安装 运行环境 Linux 依赖项 - curl-7.40.0, 获取更新版本 https://github.com/bagder/curl - openssl-1.0.1k, 获取更新版本 https://github.com/openssl/openssl 构建工程 工程采用 CMake 构建 1. 下载 sdk 到您的目录 ${Cplusplus_sdk} git clone https://github.com/tencentyoutu/cplusplus_sdk.git 2. 进入 ${Cplusplus_sdk}/thirdparty, 执行 bash install_first.sh 3. 构建 CMake 编译工程, 在 ${Cplusplus_sdk}/build 中生成二进制 sample 程序 mkdir ${Cplusplus_sdk}/build cd ${Cplusplus_sdk}/build cmake../ make 4. sdk_test.cpp 中有您想调用的接口示例, 可以仿照 ${Cplusplus_sdk}/sample/CMakeLists.txt 将 sd k 放入您的工程当中 名词 AppId 平台用后分配的 AppId SecretId 平台添加应用后分配的 SecretId SecretKey 平台添加应用后分配的 SecretKey 签名接口鉴权凭证, 由 AppId SecretId SecretKey 等生成, 详 见 http://open.youtu.qq.com/welcome/authentication 使用示例 //app sign params. ytopen_sdk::appsign m_app_sign = { 1000061, "AKID4Bhs9vqYT6mHa9TkIrAe7w5oijOCEjql",
}; "P2VTKNvTAnYNwBrqXbgxRSFQs6FTEhNJ", "3041722595" string imagedata; if(0!= read_image("a.jpg",imagedata)) { return -1; } string rsp; ytopen_sdk m_sdk; m_sdk.init(m_app_sign); if(0!= m_sdk.detectface(imagedata, true, rsp)) { cout << "DetectFace failed." << endl; } cout << rsp << endl; 初始化 示例 m_sdk.init(m_app_sign); ytopen_sdk::appsign app_id 业务中的应用标识 AppId secret_id 秘钥 SecretId secret_key 秘钥 SecretKey user_id 业务中的用户标识 返回值无 接口说明 接口调用统一返回值说明 - 返回值 - 0 成功 - -1 失败, 原因可能为秘钥鉴权失败 不合法等 人脸检测 人脸配准 接口 int DetectFace(const std::string& imagedata, bool isbigface, std::string &rsp); imagedata 待检测的图片数据 isbigface 是否大脸模式 rsp 返回的检测结果,JSON 字符串, 字段参见 API 文档 人脸比对 接口 int FaceShape(const std::string& imagedata, bool isbigface, std::string &rsp); imagedata 待检测的图片数据 isbigface 是否大脸模式 rsp 返回的配准结果,JSON 字符串, 字段参见 API 文档 接口 int FaceCompare(const std::string& imagea, const std::string&imageb, std::string &rsp);
imagea 待比对的 A 图片数据 imageb 待比对的 B 图片数据 rsp 返回的比对结果,JSON 字符串, 字段参见 API 文档 人脸验证 人脸识别 接口 int FaceVerify(const std::string& person_id, const std::string& imagedata, std:: string &rsp); person_id 待验证的人脸 id imagedata 待验证的图片数据 rsp 返回的人脸验证匹配结果,JSON 字符串, 字段参见 API 文档 新建个体 接口 int FaceIdentify(const std::string& group_id, const std::string& imagedata, std: :string &rsp); group_id 识别的组 id imagedata 待识别的图片数据 rsp 返回的 top5 识别结果,JSON 字符串, 字段参见 API 文档 删除个体 接口 int NewPerson(const std::string& person_id, const std::string &person_name, cons t std::vector<std::string> &group_ids, const std::string& imagedata, const std::strin g &tag, std::string &rsp); person_id 新建的个体 id, 用户指定, 需要保证 app_id 下的唯一性 person_name 新建的个体名称 group_ids 新建的个体存放的组 id, 可以指定多个组 id, 用户指定 ( 组默认创 建 ) imagedata 包含个体人脸的图片数据 tag 备注信息, 用户自解释字段 rsp 返回的新建状态结果,JSON 字符串, 字段参见 API 文档 增加人脸 接口 int DelPerson(const std::string& person_id, std::string &rsp); person_id 待删除的个体 id rsp 返回的删除状态结果,JSON 字符串, 字段参见 API 文档 删除人脸 接口 int AddFace(const std::string& person_id, const std::vector<std::string>& imaged atas, const std::string &tag, std::string &rsp); person_id 新增人脸的个体身份 id imagedatas 待增加的包含人脸的图片数据, 可加入多张 ( 包体大小 <2m) tag 人脸备注信息, 用户自解释字段 rsp 返回的人脸增加状态结果,JSON 字符串, 字段参见 API 文档
获取信息 接口 int DelFace(const std::string& person_id, const std::vector<std::string>& face_i ds, std::string &rsp); person_id 待删除人脸的个体身份 id face_ids 待删除的人脸 id rsp 返回的人脸删除状态结果,JSON 字符串, 字段参见 API 文档 设置信息 接口 int GetInfo(const std::string& person_id, std::string &rsp); person_id 待查询的个体身份 id rsp 返回的查询结果,JSON 字符串, 字段参见 API 文档 接口 int SetInfo(const std::string& person_id, const std::string& person_name, const std::string& tag, std::string &rsp); 获取组列表 person_id 待设置的个体身份 id person_name 新设置的个体名字 tag 新设置的人脸备注信息 rsp 返回的状态结果,JSON 字符串, 字段参见 API 文档 接口 int GetGroupIds(std::string &rsp); 获取个体列表 rsp 返回的组列表查询结果,JSON 字符串, 字段参见 API 文档 接口 int GetPersonIds(const std::string& group_id, std::string &rsp); 获取人脸列表 group_id 待查询的组 id rsp 返回的个体列表查询结果,JSON 字符串, 字段参见 API 文档 接口 int GetFaceIds(const std::string& person_id, std::string &rsp); 获取人脸信息 person_id 待查询的个体 id rsp 返回的人脸列表查询结果,JSON 字符串, 字段参见 API 文档 接口 int GetFaceInfo(const std::string&face_id, std::string &rsp); face_id 待查询的人脸 id rsp 返回的人脸信息查询结果,JSON 字符串, 字段参见 API 文档 更多详情和文档说明参见腾讯云智能优图服务腾讯优图开放平台