예제 #1
0
파일: BaiduFace.cs 프로젝트: xxmm2018/vb
 // Use this for initialization
 private void Awake()
 {
     instance = this;
     System.Net.ServicePointManager.ServerCertificateValidationCallback +=
         delegate(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate,
                  System.Security.Cryptography.X509Certificates.X509Chain chain,
                  System.Net.Security.SslPolicyErrors sslPolicyErrors)
     {
         return(true);       // **** Always accept
     };
 }
예제 #2
0
        static void Main(string[] args)
        {
            BaiduFace client = new BaiduFace("appkey", "appsecret");

            var file1 = AppDomain.CurrentDomain.BaseDirectory + "panzi.jpg";
            var file2 = AppDomain.CurrentDomain.BaseDirectory + "zhouxingchi2.jpg";

            var fileAdd = AppDomain.CurrentDomain.BaseDirectory + "yujingying1.png";

            //检测人脸
            //{"result_num":1,"result":[{"location":{"left":33,"top":45,"width":39,"height":30},"face_probability":0.95188879966736,"rotation_angle":-2,"yaw":-12.481206893921,"pitch":-1.5474016666412,"roll":-3.5593690872192}],"log_id":573119120}
            var result = client.FaceCheck(fileAdd);


            //人脸对比
            //var result = client.FaceCompare(file1, file2);

            //人脸注册
            //result.success = true;
            //var result = client.FaceAdd(new UserFaceRegister
            //{
            //    GroupId = "macrosage1",
            //    Image = fileAdd,
            //    UserId = "131276",
            //    UserInfo = "余晶莹"
            //});

            //人脸删除
            //var result = client.FaceDelete("131277", "macrosage1");

            //人脸获取
            //var result = client.FaceGet("131276", "macrosage1");

            //组获取
            //var result = client.FaceGetGroup();

            //获取群组下的用户
            //var result = client.FaceGetGroupUsers("macrosage2", 0, 1000);

            //删除某个群组下的某个用户
            //var result = client.FaceDeleteGroupUser("131276", "macrosage1");

            //复制一个组的用户去其他组
            //var result = client.FaceAddGroupUserToOther("macrosage1", "131276", "macrosage2");

            //人脸识别
            //var result = client.FaceIdentify("macrosage1", fileAdd);

            //人脸验证
            //var result = client.FaceVerify("131276", fileAdd, "macrosage1", "macrosage2");
            Console.Read();
        }
예제 #3
0
        /// <summary>
        /// Main
        /// </summary>
        public Form1()
        {
            InitializeComponent();

            logger = new SimpleLogger();

            scanner = new TX400Scanner();
            OpenScanner();

            camera = new CameraCV();

            pcontroller = new PlatformController();
            OpenController();

            //调试用,直接对接百度API
            CVclient = new BaiduFace();

            speech = new BaiduSpeech();

            client = new APIClient();
            logger.Info("Get Client Token = " + APIClient.token);

            //启动timer,周期刷新picturebox
            pictureboxRefreshTimer           = new System.Timers.Timer();
            pictureboxRefreshTimer.Interval  = 1000;
            pictureboxRefreshTimer.Elapsed  += new System.Timers.ElapsedEventHandler(pictureboxRefresh);
            pictureboxRefreshTimer.AutoReset = true;
            pictureboxRefreshTimer.Start();

            //启动timer,周期刷新faceError
            faceErrorResetTimer           = new System.Timers.Timer();
            faceErrorResetTimer.Elapsed  += new System.Timers.ElapsedEventHandler(faceErrorReset);
            faceErrorResetTimer.AutoReset = true;
            faceErrorResetTimer.Interval  = 10000;
            faceErrorResetTimer.Start();

            //设置lock timer
            LockTimer          = new System.Timers.Timer();
            LockTimer.Elapsed += new ElapsedEventHandler(UnlockSystem);

            //open pictualbox always on
            SetPictureBoxVisibility(pictureBoxAlwaysOn, true);
        }