alpha
Login
or
Join now
nateholland.bsky.social
/
PoseDetection
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
refactor: resolve merge issues
author
nathan holland
date
1 year ago
(May 22, 2025, 4:07 PM +0300)
commit
16fe4094
16fe409417b33ff618d87ca4e02ffb8636dfda30
parent
a2739c10
a2739c10fd79a7cbcfc2172e73ffe781717d8657
+21
-18
2 changed files
Expand all
Collapse all
Unified
Split
posedetection
build.gradle.kts
src
iosMain
kotlin
com
performancecoachlab
posedetection
camera
FrameProcessor.kt
+1
-1
posedetection/build.gradle.kts
Reviewed
···
4
4
5
5
mavenPublishing {
6
6
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
7
7
-
coordinates("com.performancecoachlab.posedetection", "posedetection-compose", "1.1.1")
7
7
+
coordinates("com.performancecoachlab.posedetection", "posedetection-compose", "1.1.2")
8
8
9
9
pom {
10
10
name.set("Pose Detection")
+20
-17
posedetection/src/iosMain/kotlin/com/performancecoachlab/posedetection/camera/FrameProcessor.kt
Reviewed
···
37
37
import platform.Vision.VNRequest
38
38
import kotlin.native.runtime.NativeRuntimeApi
39
39
40
40
-
class FrameProcessor {
41
41
-
fun bodyPoseHandler(request: VNRequest): MutableMap<VNHumanBodyPoseObservationJointName, VNRecognizedPoint>? {
42
42
-
try {
43
43
-
val observations = request.results as List<VNHumanBodyPoseObservation>
44
44
-
// Process each observation to find the recognized body pose points.
45
45
-
return observations.lastOrNull()?.let { processObservation(it) }
46
46
-
} catch (e: Exception) {
47
47
-
println("Error processing observations: ${e.message}")
48
48
-
return null
49
49
-
}
40
40
+
fun bodyPoseHandler(request: VNRequest): MutableMap<VNHumanBodyPoseObservationJointName, VNRecognizedPoint>? {
41
41
+
try {
42
42
+
val observations = request.results as List<VNHumanBodyPoseObservation>
43
43
+
// Process each observation to find the recognized body pose points.
44
44
+
return observations.lastOrNull()?.let { processObservation(it) }
45
45
+
} catch (e: Exception) {
46
46
+
println("Error processing observations: ${e.message}")
47
47
+
return null
50
48
}
49
49
+
}
51
50
52
51
@OptIn(ExperimentalForeignApi::class)
53
52
fun processObservation(observation: VNHumanBodyPoseObservation): MutableMap<VNHumanBodyPoseObservationJointName, VNRecognizedPoint> {
54
54
-
val points = emptyMap<VNHumanBodyPoseObservationJointName, VNRecognizedPoint>().toMutableMap()
53
53
+
val points =
54
54
+
emptyMap<VNHumanBodyPoseObservationJointName, VNRecognizedPoint>().toMutableMap()
55
55
observation.availableJointNames.forEach {
56
56
observation.recognizedPointForJointName(it as VNHumanBodyPoseObservationJointName, null)
57
57
?.also { point ->
···
146
146
}
147
147
try {
148
148
val result = runCatching {
149
149
-
request(requestHandler,request,errorPtr)
149
149
+
request(requestHandler, request, errorPtr)
150
150
}
151
151
152
152
if (result.isFailure) {
···
166
166
}
167
167
168
168
}
169
169
-
@OptIn(ExperimentalForeignApi::class)
170
170
-
@Throws(Throwable::class)
171
171
-
fun request(requestHandler: VNImageRequestHandler, request: VNRequest, errorPtr: ObjCObjectVar<NSError?>){
172
172
-
requestHandler.performRequests(listOf(request), errorPtr.ptr)
173
173
-
}
169
169
+
}
170
170
+
171
171
+
@OptIn(ExperimentalForeignApi::class)
172
172
+
@Throws(Throwable::class)
173
173
+
fun request(
174
174
+
requestHandler: VNImageRequestHandler, request: VNRequest, errorPtr: ObjCObjectVar<NSError?>
175
175
+
) {
176
176
+
requestHandler.performRequests(listOf(request), errorPtr.ptr)
174
177
}
175
178