This repository has no description
0

Configure Feed

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

fix: objects detected incorrectly in no native orientation

+15 -13
+5 -7
posedetection/src/androidMain/kotlin/com.performancecoachlab/posedetection/camera/CameraView.android.kt
··· 206 206 val objectClient = if (currentDetectMode.doObject()) objectDetector?.getDetector() else null 207 207 imageProxy.process( 208 208 objectClient, poseClient, timestamp, area 209 - ){ 210 - customObjectRepository.updateCustomObject(it.objects) 211 - it.skeleton?.let { skel -> 209 + ){ analysisResult, _bitmap -> 210 + customObjectRepository.updateCustomObject(analysisResult.objects) 211 + analysisResult.skeleton?.let { skel -> 212 212 skeletonRepository.updateSkeleton(skel) 213 213 } 214 - bitmap = 215 - imageProxy.toBitmap().rotate(imageProxy.imageInfo.rotationDegrees.toFloat()) 216 - .asImageBitmap().let { inbmp -> 214 + bitmap = _bitmap.asImageBitmap().let { inbmp -> 217 215 addFrameToActiveRecordings(inbmp, timestamp) 218 - inbmp.drawResults(if(drawSkeleton) it.skeleton else null, drawObjects?.invoke(it.objects)?: emptyList()) 216 + inbmp.drawResults(if(drawSkeleton) analysisResult.skeleton else null, drawObjects?.invoke(analysisResult.objects)?: emptyList()) 219 217 } 220 218 imageProxy.close() 221 219 }
+9 -5
posedetection/src/androidMain/kotlin/com/performancecoachlab/posedetection/camera/Utils.android.kt
··· 28 28 poseDetector: PoseDetector?, 29 29 timestamp: Long, 30 30 focusArea: Rect?, 31 - onComplete: (AnalysisResult) -> Unit 31 + onComplete: (AnalysisResult, Bitmap) -> Unit 32 32 ) { 33 - val bitmap = toBitmap() 33 + val bitmap = toBitmap().rotate(imageInfo.rotationDegrees.toFloat()) 34 34 val tensorImage = TensorImage.fromBitmap(bitmap) 35 35 val mlKitImage = InputImage.fromBitmap(bitmap.applyFocusAreaMask(focusArea,imageInfo.rotationDegrees 36 36 ), imageInfo.rotationDegrees) ··· 42 42 timestamp = timestamp, 43 43 width = width, 44 44 height = height, 45 + bitmap = bitmap, 45 46 onComplete = onComplete 46 47 ) 47 48 } ··· 61 62 poseDetector: PoseDetector, 62 63 timestamp: Long, 63 64 focusArea: Rect?, 64 - onComplete: (AnalysisResult) -> Unit 65 + onComplete: (AnalysisResult, Bitmap) -> Unit 65 66 ) { 66 67 val tensorImage = TensorImage.fromBitmap(this) 67 68 val mlKitImage = InputImage.fromBitmap(this.applyFocusAreaMask(focusArea), 0) ··· 73 74 timestamp = timestamp, 74 75 width = width, 75 76 height = height, 77 + bitmap = this, 76 78 onComplete = onComplete 77 79 ) 78 80 } ··· 171 173 timestamp: Long, 172 174 width: Int, 173 175 height: Int, 174 - onComplete: (AnalysisResult) -> Unit 176 + bitmap: Bitmap, 177 + onComplete: (AnalysisResult, Bitmap) -> Unit 175 178 ) { 176 179 val objectsDetected = objectDetector?.detect(tensorImage)?.map { result -> 177 180 AnalysisObject( ··· 209 212 AnalysisResult( 210 213 skeleton = skeleton, 211 214 objects = objectsDetected 212 - ) 215 + ), 216 + bitmap 213 217 ) 214 218 } 215 219 }
+1 -1
posedetection/src/androidMain/kotlin/com/performancecoachlab/posedetection/recording/InputFrame.android.kt
··· 56 56 suspendCancellableCoroutine { continuation -> 57 57 inputFrame.bitmap.process( 58 58 objDetector, poseDetector, inputFrame.timestamp,focusArea 59 - ) { result -> 59 + ) { result, bitmap -> 60 60 continuation.resume(result) 61 61 } 62 62 }