Appery Pose detection

Pose detection

Present camera view with pose detection overlay

PoseDetector.detectPoseFromCamera

Opens the camera view with an overlay displaying detected pose landmarks. Returns the list of detected poses (for all captured frames).

Parameters
  • {function} success - callback function which takes a parameter data which will be invoked on success
  • {function} error - callback function which takes a parameter err which will be invoked on failure
Supported Options
propertyvaluedescription
detectionModeSTREAM_MODE (default) / SINGLE_IMAGE_MODEIn STREAM_MODE (default), the object detector runs with low latency, but might produce incomplete results (such as unspecified bounding boxes or category labels) on the first few invocations of the detector. Also, in STREAM_MODE, the detector assigns tracking IDs to objects, which you can use to track objects across frames. Use this mode when you want to track objects, or when low latency is important, such as when processing video streams in real time.
showDetectedPosefalse / true (default)Whether or not show silhouette of detected pose
Example
ApperyioMLCordovaPlugin.PoseDetector.detectPoseFromCamera(
    results => console.log(results),
    error => console.log(error), 
    {
        detectionMode: ApperyioMLCordovaPlugin.PoseDetector.PoseDetectorOptions.DetectionMode.STREAM,
        showDetectedPose: true
    }
);

Sample JSON callback: pose_detection.json

Present camera view with real time pose detection overlay

PoseDetector.startRealTimeDetection

Opens the camera view with an overlay displaying detected pose landmarks. Returns steam of detected poses.

Parameters
  • {function} success - callback function which takes a parameter data which will be invoked on success
  • {function} error - callback function which takes a parameter err which will be invoked on failure
Supported Options
propertyvaluedescription
detectionModeSTREAM_MODE (default) / SINGLE_IMAGE_MODEIn STREAM_MODE (default), the object detector runs with low latency, but might produce incomplete results (such as unspecified bounding boxes or category labels) on the first few invocations of the detector. Also, in STREAM_MODE, the detector assigns tracking IDs to objects, which you can use to track objects across frames. Use this mode when you want to track objects, or when low latency is important, such as when processing video streams in real time.
showDetectedPosefalse / true (default)Whether or not show silhouette of detected pose
frameImageDatatrue (default) / falseWhether include base64 of captured photo or not
frameImageResultTypeCameraResultType.BASE64_STRING (default) / CameraResultType.DATA_URLinclude captured photo as only base64 string or as full data url
delay500 (default)Time interval in msec, for performing detection each interval value
encodingTypeEncodingType.JPEG (default) / EncodingType.PNGformat of output photo base64
cameraDirectionCameraDirection.BACK (default) / CameraDirection.FRONTUse back or front camera of device during pose detection
Example
ApperyioMLCordovaPlugin.PoseDetector.startRealTimeDetection(
    results => console.log(results),
    error => console.log(error), 
    {
        detectionMode: ApperyioMLCordovaPlugin.PoseDetectorOptions.DetectionMode.STREAM,
        showDetectedPose: true,
        frameImageData: true,
        frameImageResultType: CameraResultType.DATA_URL,
        delay: 200,
        encodingType: ApperyioMLCordovaPlugin.PoseDetectorOptions.EncodingType.PNG,
        cameraDirection: ApperyioMLCordovaPlugin.PoseDetectorOptions.CameraDirection.BACK
    }
);

Sample JSON callback: pose_detection_realtime.json

Detect pose on a single image

PoseDetector.detectPose

Detects pose in a single image.

Parameters
  • {string} imageUrlOrContent - path to an image or base64 encoded image data (depending on useBase64 option)
  • {function} success - callback function which takes a parameter data which will be invoked on success
  • {function} error - callback function which takes a parameter err which will be invoked on failure
Supported Options
propertyvaluedescription
useBase64false (default) / trueWhether or not imageUrlOrContent is a base64 encoded string.
detectionModeSTREAM_MODE (default) / SINGLE_IMAGE_MODEIn STREAM_MODE (default), the object detector runs with low latency, but might produce incomplete results (such as unspecified bounding boxes or category labels) on the first few invocations of the detector. Also, in STREAM_MODE, the detector assigns tracking IDs to objects, which you can use to track objects across frames. Use this mode when you want to track objects, or when low latency is important, such as when processing video streams in real time.
Example
let path = cordova.file.applicationDirectory + "image.jpg";
ApperyioMLCordovaPlugin.PoseDetector.detectPose(
    path,
    results => console.log(results),
    error => console.log(error), 
    {
        useBase64: false,
        detectionMode: ApperyioMLCordovaPlugin.PoseDetector.PoseDetectorOptions.DetectionMode.STREAM
    }
);

Sample JSON callback: pose_detection.json