Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

camera-source.md 1.4KB

CameraSource

A source of data linked to a webcam.

Instantiation

AR.Source.Camera

AR.Source.Camera(settings: object): CameraSource

Create a new webcam-based source of data with the specified settings.

Arguments

  • settings: object, optional. An object with the following keys (all are optional):
    • resolution: Resolution. The desired resolution of the video. The higher the resolution, the longer it takes for the video to be uploaded to the GPU, which impacts performance. The lower the resolution, the less accurate the tracking will be. Suggested values: "md+", "md", "sm+", "sm".
    • aspectRatio: number. A hint specifying the preferred aspect ratio of the video.
    • constraints: MediaTrackConstraints. Additional video constraints that will be passed to navigator.mediaDevices.getUserMedia().

Returns

A new webcam-based source of data.

Example

const webcam = AR.Source.Camera({
    resolution: 'md+',
    constraints: {
        facingMode: 'environment' // will prefer the rear camera on mobile devices
        //facingMode: 'user' // will prefer the front camera on mobile devices
    }
});

Properties

resolution

source.resolution: Resolution, read-only

The resolution of this source of data. Set it when instantiating the object.