Angle update

This commit is contained in:
2026-08-12 12:46:33 +08:00
parent 18fe809d4a
commit e05aca3312
10 changed files with 244 additions and 74 deletions
@@ -36,14 +36,18 @@ class PoseAnalyzer(
/**
* Everything [PoseOverlayView] needs to both draw a pose and correctly
* map it from analysis-image pixels to view pixels.
* map it from analysis-image pixels to view pixels, plus the joint
* angles derived from that same pose (see [PoseAngleCalculator]) so
* downstream consumers (overlay text, future frame-by-frame logging)
* don't need to recompute them from [pose] themselves.
*/
data class PoseFrameResult(
val pose: Pose,
val imageWidth: Int,
val imageHeight: Int,
val rotationDegrees: Int,
val isFrontCamera: Boolean
val isFrontCamera: Boolean,
val angles: PoseAngles
)
private val detector: PoseDetector = PoseDetection.getClient(
@@ -87,7 +91,10 @@ class PoseAnalyzer(
imageWidth = width,
imageHeight = height,
rotationDegrees = rotationDegrees,
isFrontCamera = frontCamera
isFrontCamera = frontCamera,
// Cheap (four atan2 pairs at most), safe to compute
// on every frame right alongside the detection result.
angles = PoseAngleCalculator.compute(pose)
)
)
}