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]不合法!"); } } } } }