As you have already gone through the user guide, you may have come across some basic "Hello World" code that can help you create a simple web application using our SDK quickly.
In this set of samples, we will revisit the "Hello World" code and show how to implement it using some popular frameworks, such as Angular, React, and Vue.
Let's now go through each of the samples.
In this example, you will learn the minimum codes required to initialize and set up the SDK.
Let's quickly break down the methods used in order:
Dynamsoft.License.LicenseManager.initLicense(): This method initializes the license for using the SDK in the application.Dynamsoft.CVR.CaptureVisionRouter.createInstance(): This method creates aCaptureVisionRouterobjectcvRouterwhich controls the entire process in three steps:- Retrieve Images from the Image Source
cvRouterconnects to the image source through theImage Source Adapterinterface with the methodsetInput().cvRouter.setInput(cameraEnhancer);
The image source in our case is a CameraEnhancer object created with
Dynamsoft.DCE.CameraEnhancer.createInstance(view) - Coordinate Image-Processing Tasks
- The coordination happens behind the scenes.
cvRouterstarts the process by specifying a preset template "ReadSingleBarcode" with the methodstartCapturing().cvRouter.startCapturing("ReadSingleBarcode");
- The coordination happens behind the scenes.
- Dispatch Results to Listening Objects
- The processing results are returned through the
CapturedResultReceiverinterface. TheCapturedResultReceiverobjectresultReceiveris registered tocvRoutervia the methodaddResultReceiver().cvRouter.addResultReceiver(resultReceiver);
- Also note that reading from video is extremely fast and there could be many duplicate results. We can use a
MultiFrameResultCrossFilterobject with result deduplication enabled to filter out the duplicate results. The object is registered tocvRoutervia the methodaddResultFilter().cvRouter.addResultFilter(filter);
- The processing results are returned through the
- Retrieve Images from the Image Source
Read more on Capture Vision Router.
The second sample processes static images and returns barcode results.
In this sample, an event listener is set up so that the SDK decodes any images that the user uploads.
When working with the CaptureVisionRouter class for single image processing, the main method to use is capture, You can find more details about this method at the link above.
Read more in the README under "angular".
Read more in the README under "blazor".
Read more in the README under "electron".
Read more in the README under "next".
Read more in the README under "nuxt".
Read more in the README under "pwa".
Read more in the README under "react".
Read more in the README under "react-hooks".
Read more in the README under "svelte".
Read more in the README under "vue".
This sample shows how to use the SDK in a web page based on RequireJS.
This sample shows how to use the SDK in a web page based on ES6 (also known as ECMAScript 2015 or ECMAScript 6).
Read more in the README under "webview".
If you have any questions, feel free to contact Dynamsoft support.