資源簡介
實現了以下接口
https://api-cn.faceplusplus.com/facepp/v3/compare
https://api-cn.faceplusplus.com/facepp/v3/detect
https://api-cn.faceplusplus.com/facepp/v3/faceset/create
https://api-cn.faceplusplus.com/facepp/v3/faceset/addface
https://api-cn.faceplusplus.com/facepp/v3/search
人臉識別,人臉集合創建,查找,兩張人臉圖片比對
并對返回結果的json反序列化到實體對象,結果一目了然。
注: 前提需要創建一個免費的測試賬號-------
//注冊自己的face++賬號,地址:https://console.faceplusplus.com.cn/register
String strApiKey = "";
String strApiSecret = "";
//如果需要上傳人臉到人臉集合,請先創建人臉集合后填入得到的facesetToken, 人臉添加到人臉集合時需要用它制定哪個集合
String strFacesetToken = "";
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Drawing.Imaging;
using?System.IO;
using?System.Linq;
using?System.Net;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
using?System.xml.Linq;
using?WindowsFormsApplication1.Entities;
namespace?WindowsFormsApplication1
{
????public?partial?class?Form1?:?Form
????{
????????String?picPath1?=?““;
????????String?picPath2?=?““;
????????//OuterId:賬號下全局唯一的?FaceSet?自定義標識,可以生成一個UUID作為outer_id
????????String?strOuterId?=?“26c543b95fa142a5985c0aaab8b854d2“;//System.Guid.NewGuid().ToString(“N“);
????????//注冊自己的face++賬號,地址:https://console.faceplusplus.com.cn/register
????????String?strApiKey?=?““;
????????String?strApiSecret?=?““;
????????//請先創建人臉集合后填入得到的facesetToken?人臉添加到人臉集合時需要用它制定哪個集合
????????String?strFacesetToken?=?““;
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????OpenFileDialog?openFileDialog?=?new?OpenFileDialog();
????????????openFileDialog.title?=?“選擇文件“;
????????????openFileDialog.Filter?=?“jpg文件|*.jpg|png文件|*.png|所有文件|*.*“;
????????????openFileDialog.FileName?=?string.Empty;
????????????openFileDialog.FilterIndex?=?1;
????????????openFileDialog.RestoreDirectory?=?true;
????????????openFileDialog.DefaultExt?=?“jpg“;
????????????DialogResult?result?=?openFileDialog.ShowDialog();
????????????if?(result?==?System.Windows.Forms.DialogResult.Cancel)
????????????{
????????????????return;
????????????}
????????????String?filepath?=?openFileDialog.FileName;
????????????pictureBox1.ImageLocation?=?filepath;
????????????picPath1?=?filepath;
????????}
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????OpenFileDialog?openFileDialog?=?new?OpenFileDialog();
????????????openFileDialog.title?=?“選擇文件“;
????????????openFileDialog.Filter?=?“jpg文件|*.jpg|png文件|*.png|所有文件|*.*“;
????????????openFileDialog.FileName?=?string.Empty;
????????????openFileDialog.FilterIndex?=?1;
????????????openFileDialog.RestoreDirectory?=?true;
????????????openFileDialog.DefaultExt?=?“jpg“;
????????????DialogResult?result?=?openFileDialog.ShowDialog();
????????????if?(result?==?System.Windows.Forms.DialogResult.Cancel)
????????????{
????????????????return;
????????????}
????????????String?filepath?=?openFileDialog.FileName;
????????????pictureBox2.ImageLocation?=?filepath;
????????????picPath2=?filepath;
????????}
????????private?void?button3_Click(object?sender?EventArgs?e)
????????{
???????????????????
????????????Dictionaryject>?verifyPostParameters?=?new?Dictionaryject>();
????????????verifyPostParameters.Add(“api_key“?strApiKey);
????????????verifyPostParameters.Add(“api_secret“?strApiSecret);
????????????Bitmap?bmp?=?new?Bitmap(picPath1);?//?圖片地址
????????????byte[]?fileIma
- 上一篇:c#上位機串口通信助手源代碼
- 下一篇:AES加密算法C#實現帶中文說明
評論
共有 條評論