淘宝网网站建设的需求分析,wordpress help,wordpress 评论go跳转,新闻摘抄2023年一、设置登录百度云控制台#xff0c;添加应用-添加人脸识别#xff0c;查找#xff0c;对比等。设置人脸识别应用记住API Key和Secret Key二、创建Demo程序1、使用Nuget安装 Baidu.AI 和 Newtonsoft.JsonNuget2、直接下载SDK https://ai.baidu.com/file/7D961BC013AB4AA790…一、设置登录百度云控制台添加应用-添加人脸识别查找对比等。设置人脸识别应用记住API Key和Secret Key二、创建Demo程序1、使用Nuget安装 Baidu.AI 和 Newtonsoft.JsonNuget2、直接下载SDK https://ai.baidu.com/file/7D961BC013AB4AA7905001FAF89EE3273、案例代码private void simpleButton1_Click(object sender, EventArgs e) { //Devepxress 控件 Bitmap bitMap cameraControl1.TakeSnapshot(); // 设置APPID/AK/SK var API_KEY 你的ApiKey; var SECRET_KEY 你的Secret_Key; var client new Baidu.Aip.Face.Face(API_KEY, SECRET_KEY); client.Timeout 60000; // 修改超时时间 client.AppId APP_ID; string guidName Guid.NewGuid() .Jpeg; bitMap.Save(guidName, ImageFormat.Jpeg); var image ReadImg(guidName); var imageType BASE64; var groupIdList bim; // 如果有可选参数 var options new Dictionary{ {max_face_num, 1}, {match_threshold, 90}, {quality_control, NORMAL}, {liveness_control, LOW}, {max_user_num, 1}}; // 调用人脸搜索 M:N 识别可能会抛出网络等异常请使用try/catch捕获 // 带参数调用人脸搜索 M:N 识别 try { var result client.MultiSearch(image, imageType, groupIdList, options); //判断是否成功 if (result[error_msg].ToString() SUCCESS) { var list JsonConvert.DeserializeObject(result.ToString()); if (list.result.face_list ! null) { //获取用户标识 string userId list.result.face_list[0].user_list[0].user_id; memoEdit1.Text ${userId}:{DateTime.Now}; } } else { memoEdit1.Text $认证失败{guidName}:{DateTime.Now}; } } catch(Exception ex) { XtraMessageBox.Show(验证失败); Console.WriteLine(ex); } } public string ReadImg(string img) { return Convert.ToBase64String(File.ReadAllBytes(img)); }4、最终界面