Web Demos

BARCODE READER SDK DEMO

Explore the flexibe barcode reading settings to optimize for your specific usage scenario.

WEB TWAIN SDK DEMO

Try the most popular web scanner features: scan images, import local images and PDF files, edit, save to local, upload to database, and etc.

BARCODE READER JAVASCRIPT DEMO

Transform any camera-equipped devices into real-time, browser-based barcode and QR code scanners.

MRZ SCANNER WEB DEMO

Detects the machine-readable zone of a passport, scans the text, and parses into human-readable data.

APP STORE DEMOS

BARCODE READER SDK FOR IOS

BARCODE READER SDK FOR ANDROID

VIEW MORE DEMOS >
Resource Base
Table of contents

Frame Acquisition

API 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 first 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.
frameColorMode Sets or returns the color mode of the images generated by getFrame().
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

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

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.toCanvas());

See also

getFrameFromBuffer

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

getFrameFromBuffer(): DCEFrame;

Parameters

None.

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.toCanvas());

See also

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

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.

frameColorMode

Sets or returns the color mode of the images generated by getFrame(). The value is limited to “RGBA” (default), “GREY”, “RBGA”, “GRBA”, “GBRA”, “BRGA” and “BGRA”.

frameColorMode: string;

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

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

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

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 2.3.2
  • Version 2.3.1
  • Version 2.1.0
  • Version 2.0.0
  • Version 1.0.3
  • Version 1.0.1
  • Version 1.0.0
Change +
© 2003–2022 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support