Resource Base
Table of contents

Frame Acquisition

Name Description
getFrame() Returns a DCEFrame object which contains the image data of the latest frame from the video input.
singleFrameMode Returns or sets whether to enable the single-frame mode.
onSingleFrameAcquired This event is triggered when a new frame / image is acquired under the single-frame mode.

getFrame

Returns a DCEFrame object which contains the image data of the latest frame from the video input.

getFrame(region?:Region): DCEFrame

Parameters

region: optional parameter of the type Region . It specifies a rectangular area on the image. If passed, the method only returns the frame cropped by the region.

Return value

A DCEFrame object which contains the image data of the (cropped) frame and related information.

Code Snippet

// Returns only the 25% center area of the frame
let frameData = enhancer.getFrame({
    regionBottom: 75,
    regionRight: 75,
    regionLeft: 25,
    regionTop: 25,
    regionMeasuredByPercentage: true
});
document.body.appendChild(frameData.canvas);

See also

DCEFrame

Region

singleFrameMode

Returns or sets whether to enable the singe-frame mode. When the single-frame mode is enabled, the video will not stream in the built-in UI of the library. Instead, the user can click the UI to invoke the system camera interface to catch a frame or select an existing image from the device storage.

singleFrameMode: boolean

Code Snippet

let pEnhancer = null;
(async () => {
    let enhancer = await (pEnhancer = pEnhancer || Dynamsoft.DCE.CameraEnhancer.createInstance());
    enhancer.singleFrameMode = true;
    await enhancer.open();
})();

onSingleFrameAcquired

This event is triggered when a new frame / image is acquired under the single-frame mode.

onSingleFrameAcquired: (file: File) => {}

Arguments

file: a File object representing the image the user chose or a frame from the video input.

Code Snippet

let pEnhancer = null;
(async () => {
    let enhancer = await (pEnhancer = pEnhancer || Dynamsoft.DCE.CameraEnhancer.createInstance());
    enhancer.onSingleFrameAcquired = file => {
        console.log(file.size);
    };
    await enhancer.open();
})();

See also

DCEFrame

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

version 2.0.3

  • Latest version(4.0.2)
  • Version 4.x
    • Version 4.0.1
    • Version 4.0.0
  • Version 3.x
    • Version 3.3.10
    • Version 3.3.9
    • Version 3.3.8
    • Version 3.3.7
    • Version 3.3.6
    • Version 3.3.5
    • Version 3.3.4
    • Version 3.3.3
    • Version 3.3.2
    • Version 3.3.1
    • Version 3.3.0
    • Version 3.2.0
    • Version 3.1.0
    • Version 3.0.1
    • Version 3.0.0
  • Version 2.x
    • Version 2.3.5
    • Version 2.3.2
    • Version 2.3.1
    • Version 2.3.0
    • Version 2.1.4
    • Version 2.1.3
    • Version 2.1.0
    • Version 2.0.0
Change +