openface 人臉識別開放平臺

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QSFaceSDK;
namespace SDKTest
{
	class Program
	{
		public static string image_file_1 = "林志玲_1.jpg";
		static void Main(string[] args)
		{
			int app_key = 1000;
			string app_secret = "dd6da32bcd4c356ebf42733054e8a6ae";
			//初始化OpenFace核心對象
			OpenFace openface = new OpenFace(app_key, app_secret);
			if (openface.state == 1)//state == 1 表示初始化成功 
			{
				//調用本地圖片人臉分析接口(同步返回)
				Response response = openface.FaceAnalysis(image_file_1, "林志玲");
				if (response != null)
				{
					int code = response.status.code;
					TaskModel result = response.result.taskInfo;
					if(1000 == code)
					{
						//打印出返回的人臉分析信息
					}
				}
			}
			else
			{
				if (openface.state == 0)
				{
					Console.WriteLine("QSFaceSDK.dll 需要在聯網狀態下使用!");
				}
				else if (openface.state == -1)
				{
					Console.WriteLine("[Key | Secret]不合法!");
				}
			}
		}
	}
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章