Example #1
0
        // Use this for initialization
        void Start()
        {
            isUsingSeparateDetectionToggle.isOn = isUsingSeparateDetection;

            isShowingAxesToggle.isOn    = isShowingAxes;
            isShowingHeadToggle.isOn    = isShowingHead;
            isShowingEffectsToggle.isOn = isShowingEffects;

            webCamTextureToMatHelper = gameObject.GetComponent <OptimizationWebCamTextureToMatHelper> ();
            webCamTextureToMatHelper.Init();

            rectangleTracker     = new RectangleTracker();
            faceLandmarkDetector = new FaceLandmarkDetector(DlibFaceLandmarkDetector.Utils.getFilePath("shape_predictor_68_face_landmarks.dat"));

            // The coordinates of the detection object on the real world space connected with the pixel coordinates.(mm)
            objectPoints = new MatOfPoint3f(
                new Point3(-31, 72, 86), //l eye (Interpupillary breadth)
                new Point3(31, 72, 86),  //r eye (Interpupillary breadth)
                new Point3(0, 40, 114),  //nose (Nose top)
                new Point3(-20, 15, 90), //l mouse (Mouth breadth)
                new Point3(20, 15, 90),  //r mouse (Mouth breadth)
                new Point3(-69, 76, -2), //l ear (Bitragion breadth)
                new Point3(69, 76, -2)   //r ear (Bitragion breadth)
                );

            imagePoints = new MatOfPoint2f();
            rvec        = new Mat();
            tvec        = new Mat();
            rotMat      = new Mat(3, 3, CvType.CV_64FC1);
        }
Example #2
0
        // Debug
        //        public Vector2 outsideClippingRatio = new Vector2(0.0f, 0.0f);
        //        public Vector2 clippingOffset = new Vector2(0.0f, 0.0f);
        //        public float vignetteScale = 0.3f;

        //        Mat dstMatClippingROI;


        // Use this for initialization
        void Start()
        {
            isUsingDlibFaceDetecterToggle.isOn = isUsingDlibFaceDetecter;

            cascade = new CascadeClassifier(OpenCVForUnity.Utils.getFilePath("haarcascade_frontalface_alt.xml"));

            faceLandmarkDetector = new FaceLandmarkDetector(DlibFaceLandmarkDetector.Utils.getFilePath("shape_predictor_68_face_landmarks.dat"));

            webCamTextureToMatHelper = gameObject.GetComponent <OptimizationWebCamTextureToMatHelper> ();
            webCamTextureToMatHelper.Init();
        }
Example #3
0
        // Use this for initialization
        void Start()
        {
            isUsingSeparateDetectionToggle.isOn  = isUsingSeparateDetection;
            isShowingWebCamImageToggle.isOn      = isShowingWebCamImage;
            isShowingDetectedFaceRectToggle.isOn = isShowingDetectedFaceRect;

            webCamTextureToMatHelper = gameObject.GetComponent <OptimizationWebCamTextureToMatHelper> ();
            webCamTextureToMatHelper.Init();

            rectangleTracker     = new RectangleTracker();
            faceLandmarkDetector = new FaceLandmarkDetector(DlibFaceLandmarkDetector.Utils.getFilePath("shape_predictor_68_face_landmarks.dat"));
        }