private void InitFaceMeshRenderer()
    {
        // Create Face Mesh Renderer
        {
            var go = new GameObject("Face");
            go.transform.SetParent(transform);
            var faceRenderer = go.AddComponent <MeshRenderer>();
            faceRenderer.material = faceMaterial;

            m_faceMeshFilter            = go.AddComponent <MeshFilter>();
            m_faceMeshFilter.sharedMesh = FaceMeshBuilder.CreateMesh();

            m_faceKeypoints = new Vector3[FaceMesh.KEYPOINT_COUNT];
        }
    }
예제 #2
0
    private void Start()
    {
        faceDetect = new FaceDetect(faceModelFile);
        faceMesh   = new FaceMesh(faceMeshModelFile);
        draw       = new PrimitiveDraw(Camera.main, gameObject.layer);

        // Create Face Mesh Renderer
        {
            var go = new GameObject("Face");
            go.transform.SetParent(transform);
            var faceRenderer = go.AddComponent <MeshRenderer>();
            faceRenderer.material = faceMaterial;

            faceMeshFilter            = go.AddComponent <MeshFilter>();
            faceMeshFilter.sharedMesh = FaceMeshBuilder.CreateMesh();

            faceKeypoints = new Vector3[FaceMesh.KEYPOINT_COUNT];
        }

        var webCamInput = GetComponent <WebCamInput>();

        webCamInput.OnTextureUpdate.AddListener(OnTextureUpdate);
    }
예제 #3
0
    void Start()
    {
        string detectionPath = Path.Combine(Application.streamingAssetsPath, faceModelFile);

        faceDetect = new FaceDetect(detectionPath);

        string faceMeshPath = Path.Combine(Application.streamingAssetsPath, faceMeshModelFile);

        faceMesh = new FaceMesh(faceMeshPath);

        string cameraName = WebCamUtil.FindName(new WebCamUtil.PreferSpec()
        {
            isFrontFacing = false,
            kind          = WebCamKind.WideAngle,
        });

        webcamTexture      = new WebCamTexture(cameraName, 1280, 720, 30);
        cameraView.texture = webcamTexture;
        webcamTexture.Play();
        Debug.Log($"Starting camera: {cameraName}");

        draw = new PrimitiveDraw(Camera.main, gameObject.layer);

        // Create Face Mesh Renderer
        {
            var go = new GameObject("Face");
            go.transform.SetParent(transform);
            var faceRenderer = go.AddComponent <MeshRenderer>();
            faceRenderer.material = faceMaterial;

            faceMeshFilter            = go.AddComponent <MeshFilter>();
            faceMeshFilter.sharedMesh = FaceMeshBuilder.CreateMesh();

            faceKeypoints = new Vector3[FaceMesh.KEYPOINT_COUNT];
        }
    }