public void Start()
        {
            matchBuffer = null;
            timeout     = 30 * 1000;
            matchCount.Clear();
            beginDetect = new Thread(new ThreadStart(() =>
            {
                while (true && isOpened)
                {
                    bool snapshot = camera.Snapshot(out imgBuffer);
                    if (snapshot && handle > 0)
                    {
                        int isEyeClose = 0, isMouthOpen = 0, isShakeHead = 0, isNodHead = 0;
                        bool bEyeClose = true, bMouthOpen = true, bShakeHead = true, bNodHead = true;
                        LD_CheckLiving_SDK(handle, imgBuffer, 640, 480,
                                           ref isMouthOpen, ref isEyeClose, ref isNodHead, ref isShakeHead,
                                           ref bMouthOpen, ref bEyeClose, ref bNodHead, ref bShakeHead);

                        if (isEyeClose > 0 && !this.matchCount.Contains(0))
                        {
                            this.matchCount.Add(0);
                        }
                        if (isMouthOpen > 0 && !this.matchCount.Contains(1))
                        {
                            this.matchCount.Add(1);
                        }
                        if (isShakeHead > 0 && !this.matchCount.Contains(2))
                        {
                            this.matchCount.Add(2);
                        }
                        if (isNodHead > 0 && !this.matchCount.Contains(3))
                        {
                            this.matchCount.Add(3);
                        }

                        timeout -= 2;
                    }
                    if (matchCount.Count == 3 || timeout <= 0)
                    {
                        matchBuffer = imgBuffer;
                        break;
                    }
                }

                if (completedHandler != null)
                {
                    if (matchBuffer != null)
                    {
                        completedHandler.Invoke(Convert.ToBase64String(matchBuffer), "");
                    }
                    else
                    {
                        completedHandler.Invoke("", "");
                    }
                }
            }));
            beginDetect.Start();
        }
        private void GetImageEvent(object sender, AxcriterionLib._IstdfcectlEvents_GetImageEventEvent e)
        {
            string bmp    = string.Empty;
            string result = axstdfcectl1.GetImageData(0);

            bmp = GetImg64(result);
            string gray = string.Empty;

            result = axstdfcectl1.GetImageData(1);
            gray   = GetImg64(result);
            if (this.handler != null)
            {
                handler.Invoke(bmp, gray);
            }
        }