Exemple #1
0
        // Use this for initialization
        void Run()
        {
            if (string.IsNullOrEmpty(facemark_cascade_filepath) || string.IsNullOrEmpty(facemark_model_filepath))
            {
                Debug.LogError("model file is not loaded. The facemark model file can be downloaded here: https://github.com/spmallick/GSOC2017/blob/master/data/lbfmodel.yaml\n Please copy to “Assets/StreamingAssets/facemark/” folder. ");
            }

            // setup landmarks detector
            facemark = Face.createFacemarkLBF();
            facemark.loadModel(facemark_model_filepath);

            // setup face detection
            cascade = new CascadeClassifier(facemark_cascade_filepath);
            #if !UNITY_WSA_10_0
            if (cascade.empty())
            {
                Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
            }
            #endif


            #if UNITY_ANDROID && !UNITY_EDITOR
            // Avoids the front camera low light issue that occurs in only some Android devices (e.g. Google Pixel, Pixel2).
            webCamTextureToMatHelper.avoidAndroidFrontCameraLowLightIssue = true;
            #endif
            webCamTextureToMatHelper.Initialize();
        }
Exemple #2
0
        // Use this for initialization
        void Run()
        {
            if (string.IsNullOrEmpty(facemark_cascade_filepath) || string.IsNullOrEmpty(facemark_model_filepath))
            {
                Debug.LogError("model file is not loaded. The facemark model file can be downloaded here: https://github.com/spmallick/GSOC2017/blob/master/data/lbfmodel.yaml\n Please copy to “Assets/StreamingAssets/facemark/” folder. ");
            }

            // setup landmarks detector
            facemark = Face.createFacemarkLBF();
            facemark.loadModel(facemark_model_filepath);

            // setup face detection
            cascade = new CascadeClassifier(facemark_cascade_filepath);
            if (cascade.empty())
            {
                Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
            }


            webCamTextureToMatHelper.Initialize();
        }