コード例 #1
0
ファイル: Form1.cs プロジェクト: matthewgan/SmartShopSystem
 /// <summary>
 /// 关闭摄像头
 /// </summary>
 private void CloseCamera()
 {
     if (camera.isOpen)
     {
         CameraCV.SkipProcessOnFrame();
         camera.ImageCaptured -= ShowImageInPictureBox;
         camera.FaceCaptured  -= ShowFaceInPictureBox;
         camera.Close();
     }
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: matthewgan/SmartShopSystem
        /// <summary>
        /// 打开摄像头
        /// </summary>
        private void OpenCamera()
        {
            //call back function register
            camera.ImageCaptured += ShowImageInPictureBox;
            camera.FaceCaptured  += ShowFaceInPictureBox;

            //Open local pre-process
            camera.localFaceDetect         = true;
            camera.localFaceDistanceFilter = true;
            //设置人脸过滤的大小阈值, 100*100pixel的最小过滤框
            camera.SetThreshold(185);

            camera.Open();
            CameraCV.StartProcessOnFrame();
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: matthewgan/SmartShopSystem
        /// <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);
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: matthewgan/SmartShopSystem
        /// <summary>
        /// 刷新picturebox任务,在timer中调用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pictureboxRefresh(object sender, EventArgs e)
        {
            if (camera.isOpen == false)
            {
                return;
            }

            if (camera.isProcessing == false)
            {
                SetPictureBox(pictureBoxCenter, new Bitmap("face.gif"));

                //SetPictureBoxVisibility(pictureBox2, false);

                SetTileButtonVisable(tileBtn, false);

                SetPictureBoxVisibility(loadBox_small, true);

                CameraCV.StartProcessOnFrame();

                SetMessageLabel(bunifuCustomLabel1, identify_hint_str);
            }
        }