예제 #1
0
    void Start()
    {
        // Init model
        string detectionPath = Path.Combine(Application.streamingAssetsPath, poseDetectionModelFile);

        poseDetect = new PoseDetect(detectionPath);
        string landmarkPath = Path.Combine(Application.streamingAssetsPath, poseLandmarkModelFile);

        poseLandmark = new PoseLandmarkDetect(landmarkPath);

        // Init camera
        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}");

        // Init frame
        frame = Instantiate(framePrefab, Vector3.zero, Quaternion.identity, cameraView.transform);

        draw = new PrimitiveDraw()
        {
            color = Color.blue,
        };
    }
예제 #2
0
    private void Start()
    {
        faceDetect = new FaceDetect(faceModelFile);
        draw       = new PrimitiveDraw(Camera.main, gameObject.layer);

        var webCamInput = GetComponent <WebCamInput>();

        webCamInput.OnTextureUpdate.AddListener(OnTextureUpdate);
    }
예제 #3
0
    private void Start()
    {
        moveNet = new MoveNet(fileName);
        draw    = new PrimitiveDraw(Camera.main, gameObject.layer)
        {
            color = Color.green,
        };

        var webCamInput = GetComponent <WebCamInput>();

        webCamInput.OnTextureUpdate.AddListener(OnTextureUpdate);
    }
예제 #4
0
    private void Start()
    {
        palmDetect     = new PalmDetect(palmModelFile);
        landmarkDetect = new HandLandmarkDetect(landmarkModelFile);
        Debug.Log($"landmark dimension: {landmarkDetect.Dim}");

        draw = new PrimitiveDraw();

        var webCamInput = GetComponent <WebCamInput>();

        webCamInput.OnTextureUpdate.AddListener(OnTextureUpdate);
    }
예제 #5
0
    private void Start()
    {
        // Init model
        poseDetect   = new PoseDetect(poseDetectionModelFile);
        poseLandmark = new PoseLandmarkDetect(poseLandmarkModelFile, landmarkOptions);

        draw = new PrimitiveDraw(Camera.main, gameObject.layer);
        viewportLandmarks = new Vector4[PoseLandmarkDetect.LandmarkCount];

        cancellationToken = this.GetCancellationTokenOnDestroy();

        GetComponent <WebCamInput>().OnTextureUpdate.AddListener(OnTextureUpdate);
    }
예제 #6
0
    private void Start()
    {
        poseNet = new PoseNet(fileName);

        draw = new PrimitiveDraw(Camera.main, gameObject.layer)
        {
            color = Color.green,
        };

        cancellationToken = this.GetCancellationTokenOnDestroy();

        var webCamInput = GetComponent <WebCamInput>();

        webCamInput.OnTextureUpdate.AddListener(OnTextureUpdate);
    }
        public GameControl(Game game)
            : base(game)
        {
            input = new InputProvider(game);
            particles = new ParticleProvider();
            Stars = new StarField(game, 2, 1, 0.5f);
            FrontPlotter = new PrimitiveDraw(game);
            BackPlotter = new PrimitiveDraw(game);

            Hud = new Hud(game);
            text = new TextInterface(game, new Vector2(1360, 730));

            extensions = new ExtensionsManager();
            
        }
    void Start()
    {
        string path = Path.Combine(Application.streamingAssetsPath, fileName);

        poseNet = new PoseNet(path);

        // Init camera
        string cameraName = WebCamUtil.FindName();

        webcamTexture = new WebCamTexture(cameraName, 640, 480, 30);
        webcamTexture.Play();
        cameraView.texture = webcamTexture;

        draw = new PrimitiveDraw()
        {
            color = Color.green,
        };
    }
    void Start()
    {
        string detectionPath = Path.Combine(Application.streamingAssetsPath, faceModelFile);

        faceDetect = new FaceDetect(detectionPath);

        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);
    }
    void Start()
    {
        // Init model
        string detectionPath = Path.Combine(Application.streamingAssetsPath, poseDetectionModelFile);
        string landmarkPath  = Path.Combine(Application.streamingAssetsPath, poseLandmarkModelFile);

        switch (mode)
        {
        case Mode.UpperBody:
            poseDetect   = new PoseDetectUpperBody(detectionPath);
            poseLandmark = new PoseLandmarkDetectUpperBody(landmarkPath);
            break;

        case Mode.FullBody:
            poseDetect   = new PoseDetectFullBody(detectionPath);
            poseLandmark = new PoseLandmarkDetectFullBody(landmarkPath);
            break;

        default:
            throw new System.NotSupportedException($"Mode: {mode} is not supported");
        }

        // Init camera
        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);
        worldJoints = new Vector3[poseLandmark.JointCount];

        cancellationToken = this.GetCancellationTokenOnDestroy();
    }
    void Start()
    {
        // Init model
        poseDetect   = new PoseDetect(poseDetectionModelFile);
        poseLandmark = new PoseLandmarkDetect(poseLandmarkModelFile);

        // Init camera
        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);
        worldJoints = new Vector4[PoseLandmarkDetect.JointCount];

        cancellationToken = this.GetCancellationTokenOnDestroy();
    }
예제 #12
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);
    }
예제 #13
0
    void Start()
    {
        string palmPath = Path.Combine(Application.streamingAssetsPath, palmModelFile);

        palmDetect = new PalmDetect(palmPath);

        string landmarkPath = Path.Combine(Application.streamingAssetsPath, landmarkModelFile);

        landmarkDetect = new HandLandmarkDetect(landmarkPath);
        Debug.Log($"landmark dimension: {landmarkDetect.Dim}");

        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}");

        // Init frames
        frames = new Image[PalmDetect.MAX_PALM_NUM];
        var parent = cameraView.transform;

        for (int i = 0; i < frames.Length; i++)
        {
            frames[i] = Instantiate(framePrefab, Vector3.zero, Quaternion.identity, parent);
            frames[i].transform.localPosition = Vector3.zero;
        }

        draw = new PrimitiveDraw()
        {
            color = Color.blue,
        };
    }
예제 #14
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];
        }
    }
예제 #15
0
    void Start()
    {
        string palmPath = Path.Combine(Application.streamingAssetsPath, palmModelFile);

        palmDetect = new PalmDetect(palmPath);

        string landmarkPath = Path.Combine(Application.streamingAssetsPath, landmarkModelFile);

        landmarkDetect = new HandLandmarkDetect(landmarkPath);
        Debug.Log($"landmark dimension: {landmarkDetect.Dim}");

        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();
    }
예제 #16
0
 private void InitDrawPrimitves()
 {
     m_drawPrimitive = new PrimitiveDraw(Camera.main, gameObject.layer);
 }