void TakeSnapshot()
    {
        Texture2D snap = new Texture2D(webCamTextureToMatHelper.GetWidth(), webCamTextureToMatHelper.GetHeight());

        snap.SetPixels(webCamTextureToMatHelper.GetWebCamTexture().GetPixels());
        snap.Apply();

        System.IO.File.WriteAllBytes(_SavePath + _CaptureCounter.ToString() + ".png", snap.EncodeToPNG());
        ++_CaptureCounter;
    }
Esempio n. 2
0
    IEnumerator Start()
    {
        Input.backButtonLeavesApp = true;
        Screen.sleepTimeout       = SleepTimeout.NeverSleep;

        _detector       = GetComponent <FaceDetector>();
        _apiManager     = GetComponent <FaceApiManager>();
        _toMatHelperMgr = GetComponent <WebCamTextureToMatHelperManager>();
        _toMatHelper    = GetComponent <WebCamTextureToMatHelper>();

        //カメラ等の初期化完了後,画像サイズを取得する
        _toMatHelper.Initialize();
        yield return(WaitInitialization());

        var imgSize = new Size(_toMatHelper.GetWidth(), _toMatHelper.GetHeight());

        _zeroMat = new ZeroMat(imgSize);

        _volume.profile.TryGetSettings(out _distortion);
    }