예제 #1
0
        void Start()
        {
            _frameToMatHelper = gameObject.GetComponent <FrameToMatHelper>();
            _screenshotPath   = Application.persistentDataPath + "/Screenshot/";

            var files = GetFiles(_screenshotPath);

            _matArray = InitMatArray(files);

            if (_matArray.Length <= 0)
            {
                OnCapturePatternButtonClick();
            }
            else
            {
                _patternDetector = new PatternDetector(null, null, true);
                _patternsArray   = new Pattern[_matArray.Length];

                for (int i = 0; i < _matArray.Length; i++)
                {
                    Cv2.CvtColor(_matArray[i], _matArray[i], ColorConversionCodes.BGR2RGB);
                    _patternsArray[i] = new Pattern();
                    _patternDetector.BuildPatternFromImage(_matArray[i], _patternsArray[i]);
                }
                _frameToMatHelper.Initialize();
                Debug.Log("patternMatArray length: " + _matArray.Length);
                _waitForSeconds = new WaitForSeconds(1f / _frameToMatHelper.GetFPS());
            }
        }
        // Use this for initialization
        void Start()
        {
            _frameToMatHelper = gameObject.GetComponent <FrameToMatHelper> ();
            _frameToMatHelper.Initialize();


            _detector             = OpenCvSharp.ORB.Create(500);
            _detector.MaxFeatures = 1000;
            _keypoints            = new OpenCvSharp.KeyPoint[] { };

            _screenshotFolder = Application.persistentDataPath + "/Screenshot/";
            if (!Directory.Exists(_screenshotFolder))
            {
                Directory.CreateDirectory(_screenshotFolder);
            }
        }