CaptureVisionRouter Multiple Image Processing
| Name | Description |
|---|---|
| setInput() | Sets up an image source to provide images for continuous processing. |
| getInput() | Returns the image source object. |
| addResultReceiver() | Adds a CapturedResultReceiver object as the receiver of captured results. |
| removeResultReceiver() | Removes the specified CapturedResultReceiver object. |
| addResultFilter() | Adds a MultiFrameResultCrossFilter object to filter non-essential results. |
| removeResultFilter() | Removes the specified MultiFrameResultCrossFilter object. |
| startCapturing() | Initiates a capturing process based on a specified template. |
| stopCapturing() | Stops the capturing process. |
| switchCapturingTemplate() | Switches the currently active capturing template during the image processing workflow. |
setInput
Sets up an image source to provide images for continuous processing.
Syntax
setInput(imageSource: ImageSourceAdapter): void;
Parameters
imageSource: The image source which is compliant with the ImageSourceAdapter interface.
Return Value
None.
Code snippet
router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
let view = await Dynamsoft.DCE.CameraView.createInstance();
cameraEnhancer = await Dynamsoft.DCE.CameraEnhancer.createInstance(view);
router.setInput(cameraEnhancer);
See Also
getInput
Returns the image source object.
Syntax
getInput(): ImageSourceAdapter;
Parameters
None.
Return Value
Returns the current image source.
Code snippet
const imageSource = CaptureVisionRouter.getInput();
addResultReceiver
Adds a CapturedResultReceiver object as the receiver of captured results.
Syntax
addResultReceiver(receiver: CapturedResultReceiver): void;
Parameters
receiver: The receiver object, of type CapturedResultReceiver.
Return Value
None.
Code snippet
router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
const resultReceiver = new Dynamsoft.CVR.CapturedResultReceiver();
resultReceiver.onCapturedResultReceived = (result) => {
/* Do something with the result */
};
router.addResultReceiver(resultReceiver);
See also
removeResultReceiver
Removes the specified CapturedResultReceiver object.
Syntax
removeResultReceiver(receiver: CapturedResultReceiver): void;
Parameters
receiver: The receiver object, of type CapturedResultReceiver.
Return Value
None.
Code snippet
router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
const resultReceiver = new Dynamsoft.CVR.CapturedResultReceiver();
resultReceiver.onCapturedResultReceived = (result) => {
/* Do something with the result */
};
router.addResultReceiver(resultReceiver);
//...
router.removeResultReceiver(resultReceiver);
See also
addResultFilter
Adds a MultiFrameResultCrossFilter object to filter non-essential results.
Syntax
addResultFilter(filter: MultiFrameResultCrossFilter): Promise<void>;
Parameters
filter: The filter object, of type MultiFrameResultCrossFilter.
Return Value
A promise that resolves when the operation has successfully completed. It does not provide any value upon resolution.
Code snippet
filter = new Dynamsoft.Utility.MultiFrameResultCrossFilter();
router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
router.addResultFilter(filter);
In the provided code snippet, the default filter implementation is utilized. This filter can offer cross-validation and de-duplication functionalities. To utilize this filter, it’s necessary to include the corresponding package
dynamsoft-utility.
See also
removeResultFilter
Removes the specified MultiFrameResultCrossFilter object.
Syntax
removeResultFilter(filter: MultiFrameResultCrossFilter): : Promise<void>;
Parameters
filter: The filter object, of type MultiFrameResultCrossFilter.
Return Value
A promise that resolves when the operation has successfully completed. It does not provide any value upon resolution.
Code snippet
filter = new Dynamsoft.Utility.MultiFrameResultCrossFilter();
router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
router.addResultFilter(filter);
// ...
router.removeResultFilter(filter);
startCapturing
Initiates a capturing process based on a specified template. This process is repeated for each image fetched from the source.
Syntax
startCapturing(templateName?: string): Promise<void>;
Parameters
templateName: specifies a “CaptureVisionTemplate” to use. If not specified, the preset template named ‘Default’ will be used.
There are two types of CaptureVisionTemplates: the preset ones which come with the SDK and the custom ones that get initialized when the user calls initSettings.
Please be aware that the preset CaptureVisionTemplates will be overwritten if the user calls initSettings and passes customized settings.
Return Value
A promise that resolves when the capturing process has successfully started. It does not provide any value upon resolution.
Code snippet
router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
await router.startCapturing("ReadSingleBarcode");
stopCapturing
Stops the capturing process.
Syntax
stopCapturing(): void;
Parameters
None.
Return Value
None.
Code snippet
router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
await router.startCapturing("ReadSingleBarcode");
// ...
router.stopCapturing();
switchCapturingTemplate
Switches the currently active capturing template during the image processing workflow. This allows dynamic reconfiguration of the capture process without restarting or reinitializing the system, enabling different settings or rules to be applied on the fly.
Syntax
switchCapturingTemplate(templateName: string): Promise<void>;
Parameters
templateName: The name of the new capturing template to apply.
Return Value
A promise that resolves when the operation has completed.
Code snippet
let router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
await router.startCapturing("ReadSingleBarcode");
// Switching to ReadRateFirst template
await router.switchCapturingTemplate("ReadBarcodes_ReadRateFirst");
Remarks
Introduced in Dynamsoft Barcode Reader Bundle version 11.2.2000 and Dynamsoft Capture Vision Bundle version 3.2.2000.