This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

refactor: resolve merge issues

+21 -18
+1 -1
posedetection/build.gradle.kts
··· 4 4 5 5 mavenPublishing { 6 6 publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) 7 - coordinates("com.performancecoachlab.posedetection", "posedetection-compose", "1.1.1") 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
··· 37 37 import platform.Vision.VNRequest 38 38 import kotlin.native.runtime.NativeRuntimeApi 39 39 40 - class FrameProcessor { 41 - fun bodyPoseHandler(request: VNRequest): MutableMap<VNHumanBodyPoseObservationJointName, VNRecognizedPoint>? { 42 - try { 43 - val observations = request.results as List<VNHumanBodyPoseObservation> 44 - // Process each observation to find the recognized body pose points. 45 - return observations.lastOrNull()?.let { processObservation(it) } 46 - } catch (e: Exception) { 47 - println("Error processing observations: ${e.message}") 48 - return null 49 - } 40 + fun bodyPoseHandler(request: VNRequest): MutableMap<VNHumanBodyPoseObservationJointName, VNRecognizedPoint>? { 41 + try { 42 + val observations = request.results as List<VNHumanBodyPoseObservation> 43 + // Process each observation to find the recognized body pose points. 44 + return observations.lastOrNull()?.let { processObservation(it) } 45 + } catch (e: Exception) { 46 + println("Error processing observations: ${e.message}") 47 + return null 50 48 } 49 + } 51 50 52 51 @OptIn(ExperimentalForeignApi::class) 53 52 fun processObservation(observation: VNHumanBodyPoseObservation): MutableMap<VNHumanBodyPoseObservationJointName, VNRecognizedPoint> { 54 - val points = emptyMap<VNHumanBodyPoseObservationJointName, VNRecognizedPoint>().toMutableMap() 53 + val points = 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 - request(requestHandler,request,errorPtr) 149 + request(requestHandler, request, errorPtr) 150 150 } 151 151 152 152 if (result.isFailure) { ··· 166 166 } 167 167 168 168 } 169 - @OptIn(ExperimentalForeignApi::class) 170 - @Throws(Throwable::class) 171 - fun request(requestHandler: VNImageRequestHandler, request: VNRequest, errorPtr: ObjCObjectVar<NSError?>){ 172 - requestHandler.performRequests(listOf(request), errorPtr.ptr) 173 - } 169 + } 170 + 171 + @OptIn(ExperimentalForeignApi::class) 172 + @Throws(Throwable::class) 173 + fun request( 174 + requestHandler: VNImageRequestHandler, request: VNRequest, errorPtr: ObjCObjectVar<NSError?> 175 + ) { 176 + requestHandler.performRequests(listOf(request), errorPtr.ptr) 174 177 } 175 178