Interface DeepARParams

Parameters for the initialization of DeepAR object.

Hierarchy

  • DeepARParams

Properties

licenseKey: string

License key created on DeepAR developer portal for your web app.

canvas: HTMLCanvasElement

Canvas element where DeepAR will render the camera and effects/filters.

effect?: string

The URL of a DeepAR effect file. This effect will be applied when DeepAR is initialized. This parameter is optional. You can always later switch to a different effect with switchEffect.

rootPath?: string

Path to the root directory of the DeepAR SDK. This path will be used to locate and download all the additional needed files like ML models and wasm files. By default, this points to the JsDelivr CDN. For example "https://cdn.jsdelivr.net/npm/deepar@5.0.0/".

If you want to host the DeepAR SDK yourself set the path to it here. It is recommended to host DeepAR SDK on your own since then you can use compressions like gzip and brotli on the files.

⚠️ Be sure that the version of DeepAR js file and the root SDK path match!

DeepAR SDK can be hosted on any other server, but be sure not to change the directory and file structure of DeepAR SDK when hosing it.

To configure usage of non-default ML models, define them in the additionalOptions.

additionalOptions?: {
    cameraConfig?: {
        disableDefaultCamera?: boolean;
        facingMode?: string;
        cameraPermissionAsked?: (() => void);
        cameraPermissionGranted?: (() => void);
    };
    hint?: string | string[];
    faceTrackingConfig?: {
        modelPath: string;
    };
    segmentationConfig?: {
        modelPath: string;
    };
    footTrackingConfig?: {
        poseEstimationWasmPath?: string;
        detectorPath?: string;
        trackerPath?: string;
        objPath?: string;
        tfjsBackendWasmPath?: string;
        tfjsBackendWasmSimdPath?: string;
        tfjsBackendWasmThreadedSimdPath?: string;
    };
    wristTrackingConfig?: {
        poseEstimationWasmPath?: string;
        detectorPath?: string;
        trackerPath?: string;
        objPath?: string;
        tfjsBackendWasmPath?: string;
        tfjsBackendWasmSimdPath?: string;
        tfjsBackendWasmThreadedSimdPath?: string;
    };
    deeparWasmPath?: string;
}

Additional DeepAR options.

Type declaration

  • Optional cameraConfig?: {
        disableDefaultCamera?: boolean;
        facingMode?: string;
        cameraPermissionAsked?: (() => void);
        cameraPermissionGranted?: (() => void);
    }

    Camera options. DeepAR will use the camera by default.

    • Optional disableDefaultCamera?: boolean

      If true, DeepAR will not use camera preview by default and all the other options here are ignored in that case. You can use your own camera/video by calling setVideoElement or start the camera at any time by calling startCamera

    • Optional facingMode?: string

      Can be "user" or "environment". User will be a front facing camera on mobile devices, while environment will be the back facing camera. Default is "user".

    • Optional cameraPermissionAsked?: (() => void)
        • (): void
        • Called when the camera permission is asked.

          Returns void

    • Optional cameraPermissionGranted?: (() => void)
        • (): void
        • Called when the camera permission is granted.

          Returns void

  • Optional hint?: string | string[]

    Provide a hint or hints to DeepAR to optimize the SDK in some scenarios.

    Available hints:

    • faceModelsPredownload - Will download the face models as soon as possible.
    • segmentationModelsPredownload - Will download the segmentation models as soon as possible. Note - it will not try to initialize segmentation. Segmentation will be lazy loaded when needed.
    • footModelsPredownload - Will download the foot models as soon as possible. Note - it will not try to initialize foot tracking. Foot tracking will be lazy loaded when needed.
    • segmentationInit - Will initialize segmentation as soon as possible. Without this hint segmentation is lazy loaded when some segmentation effect is loaded.
    • footInit - Will initialize foot tracking as soon as possible. Without this hint foot tracking is lazy loaded when some foot tracking effect is loaded.
  • Optional faceTrackingConfig?: {
        modelPath: string;
    }

    Face tracking module path and options.

    • modelPath: string

      Path to the face tracking model. Something like "path/to/deepar/models/face/models-68-extreme.bin".

  • Optional segmentationConfig?: {
        modelPath: string;
    }

    Segmentation module path and options.

    • modelPath: string

      Path to the segmentation model. Something like "path/to/deepar/models/segmentation/segmentation-192x192.bin".

  • Optional footTrackingConfig?: {
        poseEstimationWasmPath?: string;
        detectorPath?: string;
        trackerPath?: string;
        objPath?: string;
        tfjsBackendWasmPath?: string;
        tfjsBackendWasmSimdPath?: string;
        tfjsBackendWasmThreadedSimdPath?: string;
    }

    Foot tracking module paths and options.

    • Optional poseEstimationWasmPath?: string

      Path to the pose libPoseEstimation.wasm file, e.g. "/path/to/deepar/wasm/libPoseEstimation.wasm".

    • Optional detectorPath?: string

      Path to the detector model, e.g. "/path/to/deepar/models/foot/foot-detector.bin".

    • Optional trackerPath?: string

      Path to the tracker model, e.g. "/path/to/deepar/models/foot/foot-tracker.bin".

    • Optional objPath?: string

      Path to the foot model object file, e.g. "/path/to/deepar/models/foot/foot-model.obj".

    • Optional tfjsBackendWasmPath?: string

      Path to tfjs-backend-wasm.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm.wasm"

    • Optional tfjsBackendWasmSimdPath?: string

      Path to tfjs-backend-wasm-simd.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm-simd.wasm"

    • Optional tfjsBackendWasmThreadedSimdPath?: string

      Path to tfjs-backend-wasm-threaded-simd.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm-threaded-simd.wasm"

  • Optional wristTrackingConfig?: {
        poseEstimationWasmPath?: string;
        detectorPath?: string;
        trackerPath?: string;
        objPath?: string;
        tfjsBackendWasmPath?: string;
        tfjsBackendWasmSimdPath?: string;
        tfjsBackendWasmThreadedSimdPath?: string;
    }

    Foot tracking module paths and options.

    • Optional poseEstimationWasmPath?: string

      Path to the pose libPoseEstimation.wasm file, e.g. "/path/to/deepar/wasm/libPoseEstimation.wasm".

    • Optional detectorPath?: string

      Path to the detector model, e.g. "/path/to/deepar/models/foot/foot-detector.bin".

    • Optional trackerPath?: string

      Path to the tracker model, e.g. "/path/to/deepar/models/foot/foot-tracker.bin".

    • Optional objPath?: string

      Path to the foot model object file, e.g. "/path/to/deepar/models/foot/foot-model.obj".

    • Optional tfjsBackendWasmPath?: string

      Path to tfjs-backend-wasm.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm.wasm"

    • Optional tfjsBackendWasmSimdPath?: string

      Path to tfjs-backend-wasm-simd.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm-simd.wasm"

    • Optional tfjsBackendWasmThreadedSimdPath?: string

      Path to tfjs-backend-wasm-threaded-simd.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm-threaded-simd.wasm"

  • Optional deeparWasmPath?: string

    Path to deepar.wasm file. Something like "/path/to/deepar/wasm/deepar.wasm".

Generated using TypeDoc