Optimize Scanning Performance
In this guide, you will learn how to optimize performance by adapting barcode capture to your use case.
Before you start…
To get the most out of this guide, we recommend that you first take a look at the following guides:
Restrict the Scanning Area
The Scandit Data Capture SDK allows to restrict the area of the screen in which it is looking for barcodes and entirely ignoring the area outside of it. This can significantly improve decoding speed (especially) on slower devices. While the Scandit Data Capture SDK usually takes into consideration the entire screen by default, it might not actually be needed for some use cases or the performance gain might be worth the loss of some convenience in the form of scan area.
Take a look at how to set up the active scan area for an in-depth explanation of what can be changed. Point your attention especially towards the section about margins and the RectangularLocationSelection for a high performance gain and RadiusLocationSelection for a lower but still relevant performance gain.
Optimizing for Scan Distance
The Scandit Data Capture SDK lets you choose from different resolutions ( HD , full HD, 4k) for the video feed. Increasing the resolution typically leads to better decoding range and reading of small elements. However, it can also result in a lower framerate as more pixels need to be processed. When optimizing for your use case, you should use the lowest resolution that allows for good reading performance.
The Scandit Data Capture SDK also allows to set a default zoom when opening the camera preview. This can be especially useful to read barcodes from further away, and is usually coupled with the usage of a higher resolution.
Restrict the Active Symbologies
The type of a barcode is referred to as its symbology, e.g QR Code or Code 128. The Scandit Data Capture SDK supports numerous such symbologies and they are all disabled by default. To enable scanning of a particular barcode, its symbology must be enabled. To optimize performance you should always make sure that only the symbologies that you actually want to scan are enabled as every additionally enabled symbology will decrease the scanning performance slightly.
On top of this each symbology has additional properties, such as the active symbol counts (which reflects the length of the barcode) or color of the barcode (bright on dark or dark on bright). To optimize performance you should enable only the properties you need for each symbology as otherwise unnecessary processing might slow down the scanning.
Enable the Torch in Low Light
Getting additional light from the torch (the LED next to the camera, often used as a flashlight) can greatly improve the scanning performance in low-light environments. The Scandit Data Capture SDK can provide the user with a button to manually control the torch and also allows to turn the torch on/off programmatically.
Enable browser multithreading
You can achieve better performance by enabling multithreading in the browser that supports it. Check the Requirements Page to know what are the minimum versions that can take advantage of multithreading. To enable multithreading you must set your site to be crossOriginIsolated. This will enable the possibility for the sdk to use multithreading and significatively boost the performance. If the environment supports it the sdk will automatically use multithreading. You can programmatically check for multithreading supports using BrowserHelper.checkMultithreadingSupport()
Multithreading is particularly critical for MatrixScan so be sure to configure it correctly following this tutorial, Making your website “cross-origin isolated” using COOP, COEP and CORP. You can also check this link A guide to enable cross-origin isolation and this one Safely reviving shared memory
# An example of how headers could be set. Cross-Origin-Embedder-Policy: require-corp; Cross-Origin-Opener-Policy: same-origin; Cross-Origin-Resource-Policy: cross-origin allow-credentials; require-corp origin https://example.com https://example.net;