• 大小: 270KB
    文件类型: .7z
    金币: 2
    下载: 1 次
    发布日期: 2021-06-05
  • 语言: C#
  • 标签: Face++  C#  Demo  

资源简介

实现了以下接口 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

评论

共有 条评论