Esempio n. 1
0
        /// <summary>
        /// 释放资源。
        /// </summary>
        public void Dispose()
        {
            if (!isInitialized)
            {
                return;
            }

            Close();
            SpeechEnable = false;
            if (Frame != null)
            {
                Frame.Dispose();
                Frame = null;
            }
            if (Face != null)
            {
                Face.Dispose();
                Face = null;
            }
            if (FaceDic != null)
            {
                FaceDic.Clear();
                FaceDic = null;
            }
            FaceDetectSDK.Exit();//关闭识别库

            isInitialized = false;
        }
Esempio n. 2
0
        public DataAccess(FaceRecgnize face, FaceDictionary fdic)
        {
            _Face      = face;
            _FaceDic   = fdic;
            DataSource = DataSrcType.FileSystem;

            //InitDB();
        }
Esempio n. 3
0
        /// <summary>
        /// 初始化函数。开始之前需要先初始化。
        /// </summary>
        /// <returns></returns>
        public bool Init()
        {
            if (isInitialized)
            {
                Console.WriteLine("Init: Camera is already initialized!");
                return(false);
            }
            //初始化变量
            PicBoxRealTime     = null;
            PicBoxShotFace     = null;
            PicBoxShotFullView = null;
            PicBoxFoundPic     = null;
            isStarted          = false;
            FaceAutoUpdateOn   = false;
            _LastFacePos       = new Dictionary <int, Rectangle>();

            //初始化人脸识别库
            int init = FaceDetectSDK.Init(1);//0:VGA; 1:FHD

            if (init < 0)
            {
                Console.WriteLine("Init: FaceDetectSDK Init Failed!");
                return(false);
            }
            //创建人脸识别对象
            Face = new FaceRecgnize();
            //创建图像帧对象
            Frame = new Mat();
            //配置人脸识别类参数
            Face.DrawPenThickness = 3;
            Face.MinFaceWidth     = 20;
            FaceCmd = FaceCommand.None;
            Face.ShotFaceHandler   += onShotFaceHander;
            Face.RemoveFaceHandler += onRemoveFaceHander;

            //创建人脸字典
            FaceDic         = new FaceDictionary(this, Face);
            Data            = new DataAccess(Face, FaceDic);
            Data.DataSource = DataAccess.DataSrcType.FileSystem;

            isInitialized = true;
            return(true);
        }