···11-# Compose Multiplatform Application
11+An reatine pose detection library for [Android](https://www.android.com/) and [Compose Multiplatform](https://www.jetbrains.com/lp/compose-multiplatform/). Coil is:
22+33+## Quick Start
44+55+Import the Compose library
66+77+```kotlin
88+implementation("com.performancecoachlab.posedetection:posedetection-compose:1.0.0")
99+```
1010+1111+Add camera use to your android manifest
1212+1313+```xml
1414+<uses-feature
1515+ android:name="android.hardware.camera"
1616+ android:required="false" />
1717+<uses-permission android:name="android.permission.CAMERA" />
1818+```
1919+2020+Add camera use to you iOS info.plist
2121+2222+```xml
2323+<key>NSCameraUsageDescription</key>
2424+<string>We need access to your camera to analyse your performance.</string>
2525+```
2626+2727+## Usage
2828+2929+Request camera permissions
3030+```kotlin
3131+var permissionGranted by remember { mutableStateOf(false) }
3232+PermissionProvider().apply {
3333+ if (!hasCameraPermission()) RequestCameraPermission(onGranted = {
3434+ permissionGranted = true
3535+ }, onDenied = { permissionGranted = false }) else permissionGranted = true
3636+}
3737+```
3838+3939+Create a Skeleton Repisitory
4040+```kotlin
4141+val skeletonRepository = remember { SkeletonRepository() }
4242+```
4343+4444+Initialise the camera feed
4545+```kotlin
4646+if (permissionGranted) CameraView(skeletonRepository = skeletonRepository)
4747+```
4848+4949+Create a Pose to detect
5050+```kotlin
5151+val upRightPose = Pose(
5252+ leftShoulder = Pose.PoseRange(0.0, 40.0),
5353+ rightShoulder = Pose.PoseRange(0.0, 40.0),
5454+ leftHip = Pose.PoseRange(160.0, 180.0),
5555+ rightHip = Pose.PoseRange(160.0, 180.0),
5656+ leftKnee = Pose.PoseRange(160.0, 180.0),
5757+ rightKnee = Pose.PoseRange(160.0, 180.0)
5858+)
5959+```
26033-## Before running!
44- - check your system with [KDoctor](https://github.com/Kotlin/kdoctor)
55- - install JDK 17 or higher on your machine
66- - add `local.properties` file to the project root and set a path to Android SDK there
6161+Listen for skeleton updates and detect specific poses
6262+```kotlin
6363+val skeleton by skeletonRepository.skeletonFlow.collectAsState()
6464+val poseDetected = skeleton?.let {
6565+ upRightPose.matches(it)
6666+}
6767+```
6868+6969+Check out the sample app for full example of how to use the library.
77088-### Android
99-To run the application on android device/emulator:
1010- - open project in Android Studio and run imported android run configuration
7171+## License
11721212-To build the application bundle:
1313- - run `./gradlew :composeApp:assembleDebug`
1414- - find `.apk` file in `composeApp/build/outputs/apk/debug/composeApp-debug.apk`
1515-Run android UI tests on the connected device: `./gradlew :composeApp:connectedDebugAndroidTest`
7373+ Licensed under the Apache License, Version 2.0 (the "License");
7474+ you may not use this file except in compliance with the License.
7575+ You may obtain a copy of the License at
16761717-### iOS
1818-To run the application on iPhone device/simulator:
1919- - Open `iosApp/iosApp.xcproject` in Xcode and run standard configuration
2020- - Or use [Kotlin Multiplatform Mobile plugin](https://plugins.jetbrains.com/plugin/14936-kotlin-multiplatform-mobile) for Android Studio
2121-Run iOS simulator UI tests: `./gradlew :composeApp:iosSimulatorArm64Test`
7777+ https://www.apache.org/licenses/LICENSE-2.0
22787979+ Unless required by applicable law or agreed to in writing, software
8080+ distributed under the License is distributed on an "AS IS" BASIS,
8181+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8282+ See the License for the specific language governing permissions and
8383+ limitations under the License.