Motivation
Sometimes you have packages/pallets with several codes, with the Scandit Barcode Scanner you can scan all the codes or just a subset at the same time, saving time and money. To do this you have to use the Matrix Scan option.
Matrix Scan
Matrix Scan constantly tracks recognized barcodes' position. Thanks to this approach it is possible to implement applications which would not be feasible with the traditional barcode scanner.
Enabling Matrix Scan
To implement Matrix Scanning:
- Enable matrix scanning in the scan settings by setting Scandit.ScanSettings.matrixScanEnabled to
true
. - Set the maximum number of codes to be decoded every frame through Scandit.ScanSettings.maxNumberOfCodesPerFrame to something higher than 1, depending on the environment of the codes it is a good idea to set it higher than the number of codes that you actually want to scan.
- Change the GUI style through Scandit.ScanOverlay.setGuiStyle to Scandit.ScanOverlay.GuiStyle.MATRIXSCAN.
- For performance reasons it is important not to implement
didScan
callback while using MatrixScan in order to avoid unnecessary callback invocations. All the information about detected codes should be retrieved usingdidRecognizeNewCodes
callback. - Pass a
didRecognizeNewCodes
callback as a Scandit.BarcodePicker.show function argument - In the
didRecognizeNewCodes
callback you can get currently tracked barcodes from the session through Scandit.MatrixScanSession.newlyTrackedCodes
At this point you can start the barcode picker and any recognized barcodes of the enabled symbologies will be highlighted by a filled green rectangle. Barcodes that have been localized but not recognized will be highlighted by a green border.
Wait for multiple codes to be scanned
One of the use cases of Matrix Scan is to detect when the specified number of expected codes has been decoded by the scanner. To implement this scenario:
- In the
didRecognizeNewCodes
callback, wait until the number of expected codes have been decoded, then store the codes and pause/stop the session. If you pause and plan to resume but want to start a new session, make sure that you clear the session first.
Rejecting unwanted codes
Like normal scanning Matrix Scanning provides you the option to reject codes. Just like for normal scanning rejected codes are not added to the scan session and do not provide any feedback like vibrating or beeping. In Matrix Scan the rejected codes are still drawn on the screen but in a different color. This gives the user visual feedback that a certain code is not the one you are looking for. To implement rejection:
- Pass a
didRecognizeNewCodes
callback as a Scandit.BarcodePicker.show function argument - In the
didRecognizeNewCodes
callback you can get currently tracked barcodes from the session through Scandit.MatrixScanSession.newlyTrackedCodes - Once you've checked the tracked codes for their symbologies and/or data you can reject them through Scandit.MatrixScanSession.rejectTrackedCode.
Note: Rejecting in the didScan
callback is not allowed when using Matrix Scan.
Customizing barcodes highlighting color
You can always customize the color in which detected barcodes are highlighted on the screen. To do this you can use Scandit.ScanOverlay.setMatrixScanHighlightingColor function. You can set color for 3 states of the detected codes:
- LOCALIZED - displayed when the code has been localized but not yet recognized
- RECOGNIZED - displayed when the code has been recognized
- REJECTED - displayed when the code has been visually rejected
For example applying this setting will highlight all recognized barcodes using yourColor
: