Face++提供的 人脸识别 SDK 和 公开的API 可以实现精确的人脸识别,返回多达106个识别点,是目前市面上非常理想的人脸识别产品。这里记录一下 通过Unity 使用c# 调用Face++的detect API的过程。
首先申请Face++账号,创建应用、绑定BundleID(BundleID 与 unity 中PlaySetting的Package Name 保持一致)等必备条件,具体步骤 在Face++的官网上有详细流程点击打开链接,对于Detect API的调用参数介绍等点击打开链接。
调用代码:静态类 HttpHelper4MultipartForm
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using UnityEngine;
namespace MgLiveCOM_Eyes
{
public static class HttpHelper4MultipartForm
{
public class FileParameter
{
public byte[] File
{
get;
set;
}
public string FileName
{
get;
set;
}
public string ContentType
{
get;
set;
}
public FileParameter(byte[] file) : this(file, null)
{
}
public FileParameter(byte[] file, string filename) : this(file, filename, null)
{
}
public FileParameter(byte[] file, string filename, string contenttype)
{
this.File = file;
this.FileName = filename;
this.ContentType = contenttype;
}
}
private static readonly Encoding encoding = Encoding.UTF8;
/// <summary>
/// MultipartForm请求
/// </summary>
/// <p