Exemple #1
0
        // Use this for initialization
        void Start()
        {
            fpsMonitor = GetComponent <FpsMonitor> ();

            webCamTextureToMatHelper = gameObject.GetComponent <MLCameraPreviewToMatHelper> ();
//            int width, height;
//            Dimensions (requestedResolution, out width, out height);
//            webCamTextureToMatHelper.requestedWidth = width;
//            webCamTextureToMatHelper.requestedHeight = height;
//            webCamTextureToMatHelper.requestedFPS = (int)requestedFPS;
            webCamTextureToMatHelper.Initialize();

            // Update GUI state
            requestedResolutionDropdown.value = (int)requestedResolution;
            string[] enumNames = System.Enum.GetNames(typeof(FPSPreset));
            int      index     = Array.IndexOf(enumNames, requestedFPS.ToString());

            requestedFPSDropdown.value = index;
            rotate90DegreeToggle.isOn  = webCamTextureToMatHelper.rotate90Degree;
            flipVerticalToggle.isOn    = webCamTextureToMatHelper.flipVertical;
            flipHorizontalToggle.isOn  = webCamTextureToMatHelper.flipHorizontal;



            cascade = new CascadeClassifier();
            cascade.load(Utils.getFilePath("lbpcascade_frontalface.xml"));
            //            cascade.load (Utils.getFilePath ("haarcascade_frontalface_alt.xml"));
            if (cascade.empty())
            {
                Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
            }
        }
Exemple #2
0
        // Use this for initialization
        void Start()
        {
            fpsMonitor = GetComponent <FpsMonitor>();

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


            classes_filepath = Utils.getFilePath("dnn/" + classes);
            config_filepath  = Utils.getFilePath("dnn/" + config);
            model_filepath   = Utils.getFilePath("dnn/" + model);
            Run();
        }
        // Use this for initialization
        void Start()
        {
            webCamTextureToMatHelper = gameObject.GetComponent <MLCameraPreviewToMatHelper>();

            if (isImagesInputMode)
            {
                isImagesInputMode = InitializeImagesInputMode();
            }

            if (!isImagesInputMode)
            {
                webCamTextureToMatHelper.Initialize();
            }
        }
Exemple #4
0
        // Use this for initialization
        void Start()
        {
            fpsMonitor = GetComponent <FpsMonitor>();

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


            cascade = new CascadeClassifier();
            //cascade.load (Utils.getFilePath ("lbpcascade_frontalface.xml"));
            cascade.load(Utils.getFilePath("haarcascade_frontalface_alt.xml"));
            if (cascade.empty())
            {
                Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
            }
        }