private void Run()
        {
            faceLandmarkDetector = new FaceLandmarkDetector(sp_human_face_68_dat_filepath);

            webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> ();
            webCamTextureToMatHelper.Initialize();
        }
        // Use this for initialization
        void Start()
        {
            fpsMonitor = GetComponent <FpsMonitor>();

            displayFacePointsToggle.isOn   = displayFacePoints;
            displayAxesToggle.isOn         = displayAxes;
            displayHeadToggle.isOn         = displayHead;
            displayEffectsToggle.isOn      = displayEffects;
            enableDownScaleToggle.isOn     = enableDownScale;
            enableSkipFrameToggle.isOn     = enableSkipFrame;
            enableLowPassFilterToggle.isOn = enableLowPassFilter;

            imageOptimizationHelper  = gameObject.GetComponent <ImageOptimizationHelper>();
            webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper>();


            dlibShapePredictorFileName = DlibFaceLandmarkDetectorExample.dlibShapePredictorFileName;
#if UNITY_WEBGL && !UNITY_EDITOR
            getFilePath_Coroutine = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePathAsync(dlibShapePredictorFileName, (result) => {
                getFilePath_Coroutine = null;

                dlibShapePredictorFilePath = result;
                Run();
            });
            StartCoroutine(getFilePath_Coroutine);
#else
            dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorFileName);
            Run();
#endif
        }
Exemplo n.º 3
0
        private void Run()
        {
            faceLandmarkDetector = new FaceLandmarkDetector(shape_predictor_68_face_landmarks_dat_filepath);

            webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> ();
            webCamTextureToMatHelper.Init();
        }
        // Use this for initialization
        void Start()
        {
            fpsMonitor = GetComponent <FpsMonitor> ();

            displayFacePointsToggle.isOn   = displayFacePoints;
            displayAxesToggle.isOn         = displayAxes;
            displayHeadToggle.isOn         = displayHead;
            displayEffectsToggle.isOn      = displayEffects;
            enableLowPassFilterToggle.isOn = enableLowPassFilter;

            webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> ();


            dlibShapePredictorFileName = DlibFaceLandmarkDetectorExample.dlibShapePredictorFileName;
            #if UNITY_WEBGL && !UNITY_EDITOR
            var getFilePath_Coroutine = DlibFaceLandmarkDetector.Utils.getFilePathAsync(dlibShapePredictorFileName, (result) => {
                coroutines.Clear();

                dlibShapePredictorFilePath = result;
                Run();
            });
            coroutines.Push(getFilePath_Coroutine);
            StartCoroutine(getFilePath_Coroutine);
            #else
            dlibShapePredictorFilePath = DlibFaceLandmarkDetector.Utils.getFilePath(dlibShapePredictorFileName);
            Run();
            #endif
        }
Exemplo n.º 5
0
        private void Run()
        {
            //set 3d face object points.
            objectPoints = new MatOfPoint3f(
                new Point3(-34, 90, 83),  //l eye (Interpupillary breadth)
                new Point3(34, 90, 83),   //r eye (Interpupillary breadth)
                new Point3(0.0, 50, 120), //nose (Nose top)
                new Point3(-26, 15, 83),  //l mouse (Mouth breadth)
                new Point3(26, 15, 83),   //r mouse (Mouth breadth)
                new Point3(-79, 90, 0.0), //l ear (Bitragion breadth)
                new Point3(79, 90, 0.0)   //r ear (Bitragion breadth)
                );
            imagePoints = new MatOfPoint2f();
            rotMat      = new Mat(3, 3, CvType.CV_64FC1);

            faceLandmarkDetector = new FaceLandmarkDetector(sp_human_face_68_dat_filepath);

            webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> ();
            webCamTextureToMatHelper.Initialize();
        }
Exemplo n.º 6
0
        // Use this for initialization
        void Start()
        {
            fpsMonitor = GetComponent <FpsMonitor> ();

            webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> ();

            dlibShapePredictorFileName = DlibFaceLandmarkDetectorExample.dlibShapePredictorFileName;
            #if UNITY_WEBGL && !UNITY_EDITOR
            getFilePath_Coroutine = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePathAsync(dlibShapePredictorFileName, (result) => {
                getFilePath_Coroutine = null;

                dlibShapePredictorFilePath = result;
                Run();
            });
            StartCoroutine(getFilePath_Coroutine);
            #else
            dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorFileName);
            Run();
            #endif
        }
Exemplo n.º 7
0
        void Start()
        {
            joystick = new vJoy();
            iReport  = new vJoy.JoystickState();

            if (joystick.vJoyEnabled())
            {
                VjdStat status        = joystick.GetVJDStatus(1);
                bool    AxisX         = joystick.GetVJDAxisExist(id, HID_USAGES.HID_USAGE_X);
                int     nButtons      = joystick.GetVJDButtonNumber(id);
                int     ContPovNumber = joystick.GetVJDContPovNumber(id);
                int     DiscPovNumber = joystick.GetVJDDiscPovNumber(id);
                joystick.AcquireVJD(id);
                joystick.ResetVJD(id);
            }

            fpsMonitor = GetComponent <FpsMonitor> ();

            displayFacePointsToggle.isOn   = displayFacePoints;
            displayAxesToggle.isOn         = displayAxes;
            displayHeadToggle.isOn         = displayHead;
            displayEffectsToggle.isOn      = displayEffects;
            enableLowPassFilterToggle.isOn = enableLowPassFilter;

            webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> ();


            dlibShapePredictorFileName = DlibFaceLandmarkDetectorExample.dlibShapePredictorFileName;
            #if UNITY_WEBGL && !UNITY_EDITOR
            getFilePath_Coroutine = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePathAsync(dlibShapePredictorFileName, (result) => {
                getFilePath_Coroutine = null;

                dlibShapePredictorFilePath = result;
                Run();
            });
            StartCoroutine(getFilePath_Coroutine);
            #else
            dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorFileName);
            Run();
            #endif
        }
        // Use this for initialization
        void Start()
        {
            fpsMonitor = GetComponent <FpsMonitor> ();

            enableDownScaleToggle.isOn       = enableDownScale;
            enableSkipFrameToggle.isOn       = enableSkipFrame;
            useOpenCVFaceDetectorToggle.isOn = useOpenCVFaceDetector;

            imageOptimizationHelper  = gameObject.GetComponent <ImageOptimizationHelper> ();
            webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> ();

            dlibShapePredictorFileName = DlibFaceLandmarkDetectorExample.dlibShapePredictorFileName;
            #if UNITY_WEBGL && !UNITY_EDITOR
            getFilePath_Coroutine = GetFilePath();
            StartCoroutine(getFilePath_Coroutine);
            #else
            haarcascade_frontalface_alt_xml_filepath = OpenCVForUnity.UnityUtils.Utils.getFilePath("haarcascade_frontalface_alt.xml");
            dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorFileName);
            Run();
            #endif
        }
Exemplo n.º 9
0
        private void Run()
        {
            //set 3d face object points.
            objectPoints = new MatOfPoint3f(
                new Point3(-31, 72, 86), //l eye
                new Point3(31, 72, 86),  //r eye
                new Point3(0, 40, 114),  //nose
                new Point3(-20, 15, 90), //l mouse
                new Point3(20, 15, 90),  //r mouse
                new Point3(-69, 76, -2), //l ear
                new Point3(69, 76, -2)   //r ear
                );
            imagePoints = new MatOfPoint2f();
            rvec        = new Mat();
            tvec        = new Mat();
            rotMat      = new Mat(3, 3, CvType.CV_64FC1);

            faceLandmarkDetector = new FaceLandmarkDetector(shape_predictor_68_face_landmarks_dat_filepath);

            webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> ();
            webCamTextureToMatHelper.Init();
        }
Exemplo n.º 10
0
        // Use this for initialization
        void Start()
        {
            fpsMonitor = GetComponent <FpsMonitor> ();

            filterModeDropdown.value = (int)filterMode;

            webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> ();

            dlibShapePredictorFileName = DlibFaceLandmarkDetectorExample.dlibShapePredictorFileName;
            #if UNITY_WEBGL && !UNITY_EDITOR
            var getFilePath_Coroutine = DlibFaceLandmarkDetector.Utils.getFilePathAsync(dlibShapePredictorFileName, (result) => {
                coroutines.Clear();

                dlibShapePredictorFilePath = result;
                Run();
            });
            coroutines.Push(getFilePath_Coroutine);
            StartCoroutine(getFilePath_Coroutine);
            #else
            dlibShapePredictorFilePath = DlibFaceLandmarkDetector.Utils.getFilePath(dlibShapePredictorFileName);
            Run();
            #endif
        }