Merge branch 'merge-testing'
This commit is contained in:
@@ -41,8 +41,6 @@ import androidx.lifecycle.LifecycleOwner
|
|||||||
import com.example.jnicpp.R
|
import com.example.jnicpp.R
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
import com.google.mlkit.vision.pose.PoseLandmark // for testing
|
|
||||||
import java.util.concurrent.Executor
|
import java.util.concurrent.Executor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -325,10 +323,6 @@ class CameraXController(
|
|||||||
PoseSkeletonRenderer.draw(canvas, poseFrame.landmarks, transform, overlayBonePaint, overlayJointPaint)
|
PoseSkeletonRenderer.draw(canvas, poseFrame.landmarks, transform, overlayBonePaint, overlayJointPaint)
|
||||||
PoseSkeletonRenderer.drawAngleLabels(canvas, poseFrame.landmarks, poseFrame.angles, transform, overlayAnglePaint)
|
PoseSkeletonRenderer.drawAngleLabels(canvas, poseFrame.landmarks, poseFrame.angles, transform, overlayAnglePaint)
|
||||||
|
|
||||||
val leftWrist = poseFrame.landmarks[PoseLandmark.LEFT_WRIST]
|
|
||||||
val singleLandmark = if (leftWrist != null) mapOf(PoseLandmark.LEFT_WRIST to leftWrist) else emptyMap()
|
|
||||||
feedbackUI?.drawCircles(canvas, singleLandmark, transform, forRecord = true)
|
|
||||||
|
|
||||||
val state = recordingOverlayStateProvider?.invoke()
|
val state = recordingOverlayStateProvider?.invoke()
|
||||||
val scale = feedbackUI?.computeCamScale(canvas) ?: (minOf(targetWidth, targetHeight) / 1080f)
|
val scale = feedbackUI?.computeCamScale(canvas) ?: (minOf(targetWidth, targetHeight) / 1080f)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import androidx.camera.core.ImageProxy
|
|||||||
import com.google.mlkit.vision.common.InputImage
|
import com.google.mlkit.vision.common.InputImage
|
||||||
import com.google.mlkit.vision.pose.PoseDetection
|
import com.google.mlkit.vision.pose.PoseDetection
|
||||||
import com.google.mlkit.vision.pose.PoseDetector
|
import com.google.mlkit.vision.pose.PoseDetector
|
||||||
import com.google.mlkit.vision.pose.defaults.PoseDetectorOptions
|
import com.google.mlkit.vision.pose.accurate.AccuratePoseDetectorOptions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Bridges CameraX's [ImageAnalysis] frame stream into ML Kit's
|
* @brief Bridges CameraX's [ImageAnalysis] frame stream into ML Kit's
|
||||||
@@ -84,8 +84,8 @@ class PoseAnalyzer(
|
|||||||
// if later angle-based form analysis needs the extra precision and a
|
// if later angle-based form analysis needs the extra precision and a
|
||||||
// real device's frame rate can keep up with it.
|
// real device's frame rate can keep up with it.
|
||||||
private val detector: PoseDetector = PoseDetection.getClient(
|
private val detector: PoseDetector = PoseDetection.getClient(
|
||||||
PoseDetectorOptions.Builder()
|
AccuratePoseDetectorOptions.Builder()
|
||||||
.setDetectorMode(PoseDetectorOptions.STREAM_MODE)
|
.setDetectorMode(AccuratePoseDetectorOptions.STREAM_MODE)
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -61,8 +61,7 @@ class PoseLandmarkSmoother(
|
|||||||
SmoothedLandmark(
|
SmoothedLandmark(
|
||||||
x = prev.x + (smoothingFactor * (landmark.position.x - prev.x)),
|
x = prev.x + (smoothingFactor * (landmark.position.x - prev.x)),
|
||||||
y = prev.y + (smoothingFactor * (landmark.position.y - prev.y)),
|
y = prev.y + (smoothingFactor * (landmark.position.y - prev.y)),
|
||||||
inFrameLikelihood = prev.inFrameLikelihood +
|
inFrameLikelihood = landmark.inFrameLikelihood,
|
||||||
(smoothingFactor * (landmark.inFrameLikelihood - prev.inFrameLikelihood)),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
previous[landmark.landmarkType] = next
|
previous[landmark.landmarkType] = next
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import android.util.AttributeSet
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import com.example.jnicpp.R
|
import com.example.jnicpp.R
|
||||||
import com.google.mlkit.vision.pose.PoseLandmark // for testing
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Draws the 33 ML Kit pose landmarks and connecting skeleton lines
|
* @brief Draws the 33 ML Kit pose landmarks and connecting skeleton lines
|
||||||
@@ -126,19 +125,6 @@ class PoseOverlayView @JvmOverloads constructor(
|
|||||||
val currentLandmarks = landmarks ?: return
|
val currentLandmarks = landmarks ?: return
|
||||||
PoseSkeletonRenderer.draw(canvas, currentLandmarks, transform, bonePaint, jointPaint)
|
PoseSkeletonRenderer.draw(canvas, currentLandmarks, transform, bonePaint, jointPaint)
|
||||||
angles?.let { PoseSkeletonRenderer.drawAngleLabels(canvas, currentLandmarks, it, transform, anglePaint) }
|
angles?.let { PoseSkeletonRenderer.drawAngleLabels(canvas, currentLandmarks, it, transform, anglePaint) }
|
||||||
|
|
||||||
// currentLandmarks to change to landmarks that require highlighting
|
|
||||||
// test code to contain only left wrist in currentLandmarks to not clutter the screen
|
|
||||||
val leftWrist = currentLandmarks[PoseLandmark.LEFT_WRIST]
|
|
||||||
|
|
||||||
// Build a single‑item map if it exists
|
|
||||||
val singleLandmark = if (leftWrist != null) {
|
|
||||||
mapOf(PoseLandmark.LEFT_WRIST to leftWrist)
|
|
||||||
} else {
|
|
||||||
emptyMap()
|
|
||||||
}
|
|
||||||
// end test code
|
|
||||||
feedbackUI?.drawCircles(canvas, singleLandmark, transform)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import com.google.mlkit.vision.pose.PoseLandmark
|
|||||||
object PoseSkeletonRenderer {
|
object PoseSkeletonRenderer {
|
||||||
|
|
||||||
/** @brief Minimum `inFrameLikelihood` a landmark needs to be considered reliable enough to draw or use. */
|
/** @brief Minimum `inFrameLikelihood` a landmark needs to be considered reliable enough to draw or use. */
|
||||||
const val MIN_LIKELIHOOD = 0.5f
|
const val MIN_LIKELIHOOD = 0.35f
|
||||||
/** @brief Radius, in target/view pixels, of each drawn joint dot. */
|
/** @brief Radius, in target/view pixels, of each drawn joint dot. */
|
||||||
const val DOT_RADIUS = 8f
|
const val DOT_RADIUS = 8f
|
||||||
/** @brief Stroke width, in target/view pixels, of each drawn bone line. */
|
/** @brief Stroke width, in target/view pixels, of each drawn bone line. */
|
||||||
|
|||||||
Reference in New Issue
Block a user