faceplusplus 免费人脸识别云服务
来源:互联网 发布:老子明天不上班 知乎 编辑:程序博客网 时间:2024/04/29 17:37
faceplusplus免费人脸识别云服务
using UnityEngine;using System.Collections;using System.Runtime.InteropServices;using System.IO;public class FaceTest : MonoBehaviour{ private string api_key = "f0b0a4183f4ecf32a8791e1fc4cee84d"; private string api_secret = "iAfFeuo5eH53U4Os5w1FEzS0KA-Rm4uC"; private string url = "http://apicn.faceplusplus.com/v2/detection/detect?"; private string parameters = "&attribute=glass,pose,gender,age,race,smiling"; private string imgName = "temp.jpg"; public Texture2D img = null; // Use this for initialization void Start() { } // Update is called once per frame void Update() { } void OnGUI() { if (img != null) { GUI.DrawTexture(new Rect(0, 35, img.width, img.height), img); } if (GUI.Button(new Rect(0, 0, 100, 35), "OpenDialog")) { OpenFileName ofn = new OpenFileName(); ofn.structSize = Marshal.SizeOf(ofn); ofn.filter = "图片文件(*.jpg*.png)\0*.jpg;*.png"; ofn.file = new string(new char[256]); ofn.maxFile = ofn.file.Length; ofn.fileTitle = new string(new char[64]); ofn.maxFileTitle = ofn.fileTitle.Length; ofn.initialDir = UnityEngine.Application.dataPath;//默认路径 ofn.title = "Open Project"; ofn.defExt = "JPG"; ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;//OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR if (WindowDll.GetOpenFileName(ofn)) { Debug.Log("Selected file with full path: {0}" + ofn.file); if (!Directory.Exists(UnityEngine.Application.streamingAssetsPath)) { Directory.CreateDirectory(UnityEngine.Application.streamingAssetsPath); } File.Copy(ofn.file, UnityEngine.Application.streamingAssetsPath + "/temp.jpg"); Debug.Log("file://" + ofn.file); StartCoroutine(LoadTexture("file://" + UnityEngine.Application.streamingAssetsPath + "/temp.jpg")); } } } IEnumerator LoadTexture(string localUrl) { WWW www = new WWW(localUrl); yield return www; img = www.texture; byte[] pngData = www.texture.EncodeToJPG(); File.Delete(UnityEngine.Application.streamingAssetsPath + "/temp.jpg"); StartCoroutine(PostImage(pngData)); } IEnumerator PostImage(byte[] imgBytes) { WWWForm form = new WWWForm(); form.AddField("api_key", api_key); form.AddField("api_secret", api_secret); form.AddBinaryData("img", imgBytes, "temp.jpg", "image/jpg"); form.AddField("attribute", "glass,pose,gender,age,race,smiling"); WWW www = new WWW(url, form); yield return www; Debug.Log(www.text); }}
using UnityEngine;using System.Collections;using System;using System.Runtime.InteropServices;[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]public class OpenFileName{ public int structSize = 0; public IntPtr dlgOwner = IntPtr.Zero; public IntPtr instance = IntPtr.Zero; public String filter = null; public String customFilter = null; public int maxCustFilter = 0; public int filterIndex = 0; public String file = null; public int maxFile = 0; public String fileTitle = null; public int maxFileTitle = 0; public String initialDir = null; public String title = null; public int flags = 0; public short fileOffset = 0; public short fileExtension = 0; public String defExt = null; public IntPtr custData = IntPtr.Zero; public IntPtr hook = IntPtr.Zero; public String templateName = null; public IntPtr reservedPtr = IntPtr.Zero; public int reservedInt = 0; public int flagsEx = 0;}public class WindowDll{ [DllImport("Comdlg32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.Auto)] public static extern bool GetOpenFileName([In, Out] OpenFileName ofn); public static bool GetOpenFileName1([In, Out] OpenFileName ofn) { return GetOpenFileName(ofn); }}
工程下载点击这里
1 0
- faceplusplus 免费人脸识别云服务
- FacePlusPlus人脸识别
- Face++ 最好的免费人脸识别云服务
- 免费云服务
- 微软认知服务 人脸识别 API 之 识别
- 分享一个免费的人脸识别API、SDK~~
- 【下载】推荐一款免费的人脸识别SDK
- Android人脸识别--基于虹软免费SDK
- Linux版本的 免费的人脸识别技术。
- Linux版本的 免费的人脸识别技术。
- Linux版本的 免费的人脸识别技术。
- 推荐1款免费在线OCR文字识别服务,识别特别准确!
- 阿里云首推免费人脸识别SDK 让每个APP轻松拥有短视频AR特效
- 阿里云首推免费人脸识别SDK 让每个APP轻松拥有短视频AR特效
- 阿里云首推免费人脸识别SDK 让每个APP轻松拥有短视频AR特效
- 微软认知服务开发实践(3) - 人脸识别
- 人脸识别、指纹识别推进金融机构服务、管理双升级
- 微软认知服务 人脸识别 API 之 概述
- 不缓存页面
- MySQL写入中文乱码
- 如何将cocos2d-x项目打包成一个.exe
- Ehcache使用用例(一)
- adb模拟器键盘上的快捷键
- faceplusplus 免费人脸识别云服务
- Ehcache使用实例(二)
- 二进制数中1的个数,位运算的境界
- 关于struts2结合spring 创建action的思考 singleton prototype
- 综合业务系统-3
- 2010 RDMA-BasedJob Migration Framework for MPI over InfiniBand 学习笔记
- 正则表达式
- 2015/1/10 值班系统 错误
- www.alibaizhan.com淘宝小号交易平台