void Update() { palmDetect.Invoke(webcamTexture); cameraView.material = palmDetect.transformMat; var palms = palmDetect.GetResults(0.7f, 0.3f); UpdateFrame(palms); if (palms.Count <= 0) { if (landmarkResult != null) { landmarkResult.score = 0; } return; } // Detect only first palm landmarkDetect.Invoke(webcamTexture, palms[0]); debugPalmView.texture = landmarkDetect.inputTex; landmarkResult = landmarkDetect.GetResult(); { // 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(landmarkDetect.CropMatrix, cropedFrame.rectTransform); }
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); }