import QuickPoseCore
import QuickPoseCamera
...
class ViewController: UIViewController {
var camera: QuickPoseCamera?
var quickPose = QuickPose(sdkKey: "YOUR SDK KEY HERE")
@IBOutlet var cameraView: UIView!
@IBOutlet var overlayView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
camera = QuickPoseCamera(useFrontCamera: true)
try? camera?.start(delegate: quickPose)
let customPreviewLayer = AVCaptureVideoPreviewLayer(session: camera!.session!)
customPreviewLayer.videoGravity = .resizeAspectFill
customPreviewLayer.frame.size = view.frame.size
cameraView.layer.addSublayer(customPreviewLayer)
overlayView.contentMode = .scaleAspectFill
overlayView.frame.size = view.frame.size
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
quickPose.start(features: [.overlay(.arm(side: .left))], onFrame: { status, image, features, feedback, landmarks in
if case .success(_) = status {
DispatchQueue.main.async {
self.overlayView.image = image
}
}
})
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
camera?.stop()
quickPose.stop()
}
}```