void Start()
        {
            _uiPreview.texture = _image;

            using var detector = new BlazeFace.FaceDetector(_blazeFace);
            detector.ProcessImage(_image, 0.5f);

            var detection = detector.Detections.First();
            var cropScale = new Vector2(detection.extent.x,
                                        detection.extent.y) * 1.5f;
            var cropOffset = detection.center - cropScale / 2;

            _cropRT = new RenderTexture(192, 192, 0);

            Graphics.Blit(_image, _cropRT, cropScale, cropOffset);


            _builder = new FaceMesh.MeshBuilder(_faceMesh);
            _builder.ProcessImage(_cropRT);

            _material = new Material(_shader);
            _material.SetVector("_Scale", cropScale);
            _material.SetVector("_Offset", cropOffset);
            _material.SetBuffer("_Vertices", _builder.VertexBuffer);
        }
Esempio n. 2
0
 void Start()
 {
     _detector             = new BlazeFace.FaceDetector(_blazeFace);
     _builder              = new FaceMesh.MeshBuilder(_faceMesh);
     _cropRT               = new RenderTexture(192, 192, 0);
     _material             = new Material(_shader);
     _material.mainTexture = _texture;
 }
        void Start()
        {
            _uiPreview.texture = _image;

            _builder = new FaceMesh.MeshBuilder(_faceMesh);
            _builder.ProcessImage(_image);

            _material = new Material(_shader);
            _material.SetBuffer("_Vertices", _builder.VertexBuffer);
        }
Esempio n. 4
0
        void Start()
        {
            _detector = new BlazeFace.FaceDetector(_blazeFace);
            _builder  = new FaceMesh.MeshBuilder(_faceMesh);

            _faceMaterial = new Material(_faceShader);
            _wireMaterial = new Material(_wireShader);
            _cropMaterial = new Material(_cropShader);

            _cropRT = new RenderTexture(192, 192, 0);
        }