QuickPose iOS SDK

repository·main·Indexed 43 days ago

https://github.com/quickpose/quickpose-ios-sdk

An iOS SDK for pose estimation, skeleton tracking, and fitness counting using MediaPipe and BlazePose. It provides Swift APIs for exercise detection and range of motion measurement, featuring modules such as QuickPoseCore, QuickPoseCamera, and QuickPoseSwiftUI for integration into SwiftUI and UIKit applications.

Tokens
1.7K
Snippets
4
Records
9
Agent score
6%

What's inside QuickPose

  1. Install the SDK via Swift Package Manager

    main
    1. Open your Xcode project.
    2. Select your project file, then navigate to the Swift Packages section.
    3. Click the + button to add a new package.
    4. Enter the repository URL: https://github.com/quickpose/quickpose-ios-sdk.git.
    5. Select the modules you wish to include and click Add Package.

    Available Modules

    ModuleDescription
    QuickPoseCoreCore SDK (required)
    QuickPoseMPMediapipe Library with all models (one variant is required)
    QuickPoseMP-liteMediapipe Lite Library
    QuickPoseMP-fullMediapipe Full Library
    QuickPoseMP-heavyMediapipe Heavy Library
    QuickPoseCameraUtility Class for Integration (optional, recommended)
    QuickPoseSwiftUIUtility Classes for SwiftUI Integration (optional, recommended)
    https://github.com/quickpose/quickpose-ios-sdk.git
  2. Explore SwiftUI sample applications

    main

    The SDK provides two SwiftUI-based sample applications to demonstrate different levels of integration:

    1. Basic Demo: Demonstrates a standard, minimal setup for integrating QuickPose into a SwiftUI view hierarchy.
    2. Picker Demo: An advanced demonstration that allows users to dynamically change the Machine Learning (ML) features applied to the camera output at runtime.
  3. Install the SDK via CocoaPods

    main
    1. Open your project's Podfile.
    2. Add the following dependencies:
    pod 'QuickPoseCore', :git => 'https://github.com/quickpose/quickpose-ios-sdk.git'
    pod 'QuickPoseCamera', :git => 'https://github.com/quickpose/quickpose-ios-sdk.git'
    pod 'QuickPoseSwiftUI', :git => 'https://github.com/quickpose/quickpose-ios-sdk.git'
    1. Run pod update from your terminal.

    Module Notes

    • QuickPoseCore includes both the Core SDK and the Mediapipe Library (required).
    • QuickPoseCamera and QuickPoseSwiftUI are optional but recommended for integration.
    pod 'QuickPoseCore', :git => 'https://github.com/quickpose/quickpose-ios-sdk.git'
    pod 'QuickPoseCamera', :git => 'https://github.com/quickpose/quickpose-ios-sdk.git'
    pod 'QuickPoseSwiftUI', :git => 'https://github.com/quickpose/quickpose-ios-sdk.git'
  4. Troubleshoot 'No Such Module' error

    main

    If Xcode reports No such module QuickPoseCore or No such module QuickPoseSwiftUI, it means the linker cannot find the provided XCFrameworks.

    Solution: Ensure that the XCFrameworks are explicitly added to your build Target in Xcode.

  5. Implement QuickPose in SwiftUI

    main

    To use QuickPose in a SwiftUI application, use QuickPoseCameraView to handle the camera feed and QuickPoseOverlayView to display the processed results.

    Initialize QuickPose with your registered SDK key. Remember to call .start() in .onAppear and .stop() in .onDisappear to manage the lifecycle.

    import SwiftUI
    import QuickPoseCore
    import QuickPoseSwiftUI
    
    struct QuickPoseBasicView: View {
        
        private var quickPose = QuickPose(sdkKey: "YOUR SDK KEY HERE") // register for your free key at https://dev.quickpose.ai
        @State private var overlayImage: UIImage?
        
        var body: some View {
            GeometryReader { geometry in
                ZStack(alignment: .top) {
                    QuickPoseCameraView(useFrontCamera: true, delegate: quickPose)
                    QuickPoseOverlayView(overlayImage: $overlayImage)
                }
                .frame(width: geometry.size.width)
                .edgesIgnoringSafeArea(.all)
                .onAppear {
                    quickPose.start(features: [.overlay(.userLeftArm)], onFrame: { status, image, features,  feedback, landmarks in
                        if case .success(_) = status {
                            overlayImage = image
                        }
                    })
                }.onDisappear {
                    quickPose.stop()
                }
                
            }
        }
    }
  6. Start QuickPose processing

    main

    Use the start(features:onFrame:) method to begin processing video frames. You provide a list of desired features (like overlays) and a closure that executes for every processed frame. The closure provides the status, the processed image (with overlays), detected features, feedback, and landmarks.

    quickPose.start(features: [.overlay(.upperBody)], onFrame: { status, image, features, feedback, landmarks in
        if case .success(_) = status {
            overlayImage = image
        }
    })
  7. License information for QuickPoseCore

    main

    The QuickPoseCore component is licensed under the Apache License, Version 2.0.

    Key terms include:

    • Grant of Copyright License: A perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable license to reproduce, prepare derivative works, publicly display, perform, sublicense, and distribute the work.
    • Grant of Patent License: A perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable patent license to make, use, offer to sell, sell, import, and otherwise transfer the work.
    • Redistribution: You may reproduce and distribute copies in Source or Object form, provided you give recipients a copy of the license, include prominent notices of modifications, and retain all copyright, patent, trademark, and attribution notices.
    • Disclaimer of Warranty: The work is provided on an "AS IS" BASIS, without warranties or conditions of any kind.