This repository has no description
0

Configure Feed

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

chore: update ReadMe

+78 -17
+78 -17
README.MD
··· 1 - # Compose Multiplatform Application 1 + An reatine pose detection library for [Android](https://www.android.com/) and [Compose Multiplatform](https://www.jetbrains.com/lp/compose-multiplatform/). Coil is: 2 + 3 + ## Quick Start 4 + 5 + Import the Compose library 6 + 7 + ```kotlin 8 + implementation("com.performancecoachlab.posedetection:posedetection-compose:1.0.0") 9 + ``` 10 + 11 + Add camera use to your android manifest 12 + 13 + ```xml 14 + <uses-feature 15 + android:name="android.hardware.camera" 16 + android:required="false" /> 17 + <uses-permission android:name="android.permission.CAMERA" /> 18 + ``` 19 + 20 + Add camera use to you iOS info.plist 21 + 22 + ```xml 23 + <key>NSCameraUsageDescription</key> 24 + <string>We need access to your camera to analyse your performance.</string> 25 + ``` 26 + 27 + ## Usage 28 + 29 + Request camera permissions 30 + ```kotlin 31 + var permissionGranted by remember { mutableStateOf(false) } 32 + PermissionProvider().apply { 33 + if (!hasCameraPermission()) RequestCameraPermission(onGranted = { 34 + permissionGranted = true 35 + }, onDenied = { permissionGranted = false }) else permissionGranted = true 36 + } 37 + ``` 38 + 39 + Create a Skeleton Repisitory 40 + ```kotlin 41 + val skeletonRepository = remember { SkeletonRepository() } 42 + ``` 43 + 44 + Initialise the camera feed 45 + ```kotlin 46 + if (permissionGranted) CameraView(skeletonRepository = skeletonRepository) 47 + ``` 48 + 49 + Create a Pose to detect 50 + ```kotlin 51 + val upRightPose = Pose( 52 + leftShoulder = Pose.PoseRange(0.0, 40.0), 53 + rightShoulder = Pose.PoseRange(0.0, 40.0), 54 + leftHip = Pose.PoseRange(160.0, 180.0), 55 + rightHip = Pose.PoseRange(160.0, 180.0), 56 + leftKnee = Pose.PoseRange(160.0, 180.0), 57 + rightKnee = Pose.PoseRange(160.0, 180.0) 58 + ) 59 + ``` 2 60 3 - ## Before running! 4 - - check your system with [KDoctor](https://github.com/Kotlin/kdoctor) 5 - - install JDK 17 or higher on your machine 6 - - add `local.properties` file to the project root and set a path to Android SDK there 61 + Listen for skeleton updates and detect specific poses 62 + ```kotlin 63 + val skeleton by skeletonRepository.skeletonFlow.collectAsState() 64 + val poseDetected = skeleton?.let { 65 + upRightPose.matches(it) 66 + } 67 + ``` 68 + 69 + Check out the sample app for full example of how to use the library. 7 70 8 - ### Android 9 - To run the application on android device/emulator: 10 - - open project in Android Studio and run imported android run configuration 71 + ## License 11 72 12 - To build the application bundle: 13 - - run `./gradlew :composeApp:assembleDebug` 14 - - find `.apk` file in `composeApp/build/outputs/apk/debug/composeApp-debug.apk` 15 - Run android UI tests on the connected device: `./gradlew :composeApp:connectedDebugAndroidTest` 73 + Licensed under the Apache License, Version 2.0 (the "License"); 74 + you may not use this file except in compliance with the License. 75 + You may obtain a copy of the License at 16 76 17 - ### iOS 18 - To run the application on iPhone device/simulator: 19 - - Open `iosApp/iosApp.xcproject` in Xcode and run standard configuration 20 - - Or use [Kotlin Multiplatform Mobile plugin](https://plugins.jetbrains.com/plugin/14936-kotlin-multiplatform-mobile) for Android Studio 21 - Run iOS simulator UI tests: `./gradlew :composeApp:iosSimulatorArm64Test` 77 + https://www.apache.org/licenses/LICENSE-2.0 22 78 79 + Unless required by applicable law or agreed to in writing, software 80 + distributed under the License is distributed on an "AS IS" BASIS, 81 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 82 + See the License for the specific language governing permissions and 83 + limitations under the License.