void Update()
    {
        poseDetect.Invoke(webcamTexture);
        cameraView.material = poseDetect.transformMat;
        cameraView.rectTransform.GetWorldCorners(rtCorners);

        var pose = poseDetect.GetResults(0.7f, 0.3f);

        if (pose.score < 0)
        {
            return;
        }

        DrawFrame(ref pose);

        poseLandmark.Invoke(webcamTexture, pose);
        debugView.texture = poseLandmark.inputTex;

        if (useLandmarkFilter)
        {
            poseLandmark.FilterVelocityScale = filterVelocityScale;
        }
        var landmarkResult = poseLandmark.GetResult(useLandmarkFilter);

        if (landmarkResult.score < 0.2f)
        {
            return;
        }

        DrawCropMatrix(poseLandmark.CropMatrix);
        DrawJoints(landmarkResult.joints);
    }
Ejemplo n.º 2
0
    void Update()
    {
        poseDetect.Invoke(webcamTexture);
        cameraView.material = poseDetect.transformMat;

        var pose = poseDetect.GetResults(0.7f, 0.3f);

        UpdateFrame(ref pose);

        if (pose.score < 0)
        {
            return;
        }

        poseLandmark.Invoke(webcamTexture, pose);
        debugView.texture = poseLandmark.inputTex;

        landmarkResult = poseLandmark.GetResult(useLandmarkFilter);
        {
            // Apply webcam rotation to draw landmarks correctly
            Matrix4x4 mtx = WebCamUtil.GetMatrix(-webcamTexture.videoRotationAngle, false, webcamTexture.videoVerticallyMirrored);
            for (int i = 0; i < landmarkResult.joints.Length; i++)
            {
                landmarkResult.joints[i] = mtx.MultiplyPoint3x4(landmarkResult.joints[i]);
            }
        }

        RectTransformationCalculator.ApplyToRectTransform(poseLandmark.CropMatrix, croppedFrame.rectTransform);
    }