資源簡(jiǎn)介
實(shí)現(xiàn)了以下接口
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
人臉識(shí)別,人臉集合創(chuàng)建,查找,兩張人臉圖片比對(duì)
并對(duì)返回結(jié)果的json反序列化到實(shí)體對(duì)象,結(jié)果一目了然。
注: 前提需要?jiǎng)?chuàng)建一個(gè)免費(fèi)的測(cè)試賬號(hào)-------
//注冊(cè)自己的face++賬號(hào),地址:https://console.faceplusplus.com.cn/register
String strApiKey = "";
String strApiSecret = "";
//如果需要上傳人臉到人臉集合,請(qǐng)先創(chuàng)建人臉集合后填入得到的facesetToken, 人臉添加到人臉集合時(shí)需要用它制定哪個(gè)集合
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:賬號(hào)下全局唯一的?FaceSet?自定義標(biāo)識(shí),可以生成一個(gè)UUID作為outer_id
????????String?strOuterId?=?“26c543b95fa142a5985c0aaab8b854d2“;//System.Guid.NewGuid().ToString(“N“);
????????//注冊(cè)自己的face++賬號(hào),地址:https://console.faceplusplus.com.cn/register
????????String?strApiKey?=?““;
????????String?strApiSecret?=?““;
????????//請(qǐng)先創(chuàng)建人臉集合后填入得到的facesetToken?人臉添加到人臉集合時(shí)需要用它制定哪個(gè)集合
????????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
評(píng)論
共有 條評(píng)論