Resource Base
Table of contents

Frame Acquisition

Name Description
setScanRegion() Specifies which part of the original video is considered when processing frames.
getScanRegion() Returns the scan region.
getFrame() Returns a DCEFrame object which contains the image data of the latest frame from the video input.
getFrameFromBuffer() Returns a DCEFrame object which contains the image data of the specified buffered frame.
startFetchingLoop() Starts a fetching loop that continuously put frames in a buffer.
stopFetchingLoop() Stops the fetching loop.
isFetchingLoopStarted() Returns the state of the fetching loop.
maxNumberOfFramesInBuffer Sets or returns how many frames can be buffered.
numberOfFramesInBuffer Returns how many frames there are in the buffer.
loopInterval Returns or sets the start time of the next fetch operation.
singleFrameMode Returns or sets whether to enable the singe-frame mode.

setScanRegion

Specifies which part of the original video is considered when processing frames.

setScanRegion(region: Region): void;

Parameters

region: a Region object that specifies a part of the video.

Return value

None.

Code Snippet

let region = {
	regionLeft: 25,
	regionTop: 25, 
	regionRight: 75, 
	regionBottom: 75, 
	regionMeasuredByPercentage: true
};
enhancer.setScanRegion(region); 

See also

Region

getScanRegion

Returns the scan region.

getScanRegion(): Region;

Parameters

None.

Return value

A Region object which specifies the scan region.

Code Snippet

let region = enhancer.getScanRegion();

See also

Region

getFrame

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

getFrame(): DCEFrame;

Parameters

None.

Return value

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

Code Snippet

let frameData = enhancer.getFrame();
document.body.appendChild(frameData.canvas);

See also

DCEFrame

getFrameFromBuffer

Returns a DCEFrame object which contains the image data of the specified buffered frame.

getFrameFromBuffer(index?: number): DCEFrame;

Parameters

index: specifies which buffered frame to return when maxNumberOfFramesInBuffer is bigger than 1. If not specified, the first buffered frame is returned.

Return value

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

Code Snippet

let frameData = enhancer.getFrameFromBuffer();
document.body.appendChild(frameData.canvas);

See also

DCEFrame

startFetchingLoop

startFetchingLoop

Starts a fetching loop that continuously put frames in a buffer.

When the API is called, the SDK immediately fetches a frame and puts it into the buffer, then waits for the time set by “loopInterval” before fetching the next frame, and so on.

startFetchingLoop(): void;

Parameters

None.

Return value

None.

See also

DCEFrame

loopInterval

stopFetchingLoop

Stops the fetching loop and clears the frames buffer.

stopFetchingLoop(): void;

Parameters

None.

Return value

None.

isFetchingLoopStarted

Returns the state of the fetching loop.

isFetchingLoopStarted(): Boolean;

Parameters

None.

Return value

None.

maxNumberOfFramesInBuffer

Sets or returns how many frames can be buffered.

maxNumberOfFramesInBuffer: number;

numberOfFramesInBuffer

Returns how many frames there are in the buffer.

readonly numberOfFramesInBuffer: number;

loopInterval

Returns or sets the start time of the next fetch operation.

loopInterval: number;

See also

startFetchingLoop

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.

To get the actual data, add a event handler to the event ‘singleFrameAcquired’.

singleFrameMode: boolean;

Code Snippet

let pEnhancer = null;
(async () => {
    let enhancer = await (pEnhancer = pEnhancer || Dynamsoft.DCE.CameraEnhancer.createInstance());
    enhancer.on('singleFrameAcquired', frame => {
        document.body.appendChild(frameData.canvas);
    });
    enhancer.singleFrameMode = true;
    await enhancer.open();
})();

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

version 2.1.0

  • 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 +