Appery Selfie Segmentation

Selfie segmentation

SelfieSegmenter.segmentSelfie

Parameters
  • {string} filePath - path to image
  • {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
inputInBase64false (default) / trueWhether or not filePath is a base64 encoded string.
outputInBase64false / true (default)If true the resulting mask will be returned as base64 encoded PNG file, otherwise it will contain a path to PNG file on disk

Example

let path = cordova.file.applicationDirectory + "face.jpg";

ApperyioMLCordovaPlugin.SelfieSegmenter.segmentSelfie(
    path,
    result => console.log(result),
    error => console.log(error), 
    {"inputInBase64": false});

The result will contain a PNG-encoded grayscale image (either as base64 encoded string or a path to file depending on outputInBase64 option) with the same dimensions as the input image. Value of each pixel represents a probability that the corresponding pixel of the input image belongs to the foreground (so the white pixels have the highest probability of being in foreground).