Enable VIN on the WASM platform
What is VIN? #
The VIN (Vehicle Identification Number) feature is designed to scan barcodes specific to vehicle identification. It can be enabled either via individual methods, via configureBarkoder or a pre-defined template file.
For the pre-defined template, the VIN template is applied to the configuration. The Region of Interest (ROI) is set to capture the entire viewfinder (a rectangle sized 100% by 30% starting at the top-left corner and centered vertically).
For individual methods / configureBarkoder, code39, code128, DataMatrix, and QR decoding is enabled because all of those barcode types can be used as VIN. The decoding speed is set to slow (for better results), and the barcode resolution is set to high. Again, a ROI is set similar to the pre-defined template.
In either approach, the license key must be valid, otherwise, the results will contain asterisks.
How to enable it on WASM?#
Enabling via individual methods:
Barkoder.setEnabledDecoders(
Barkoder.constants.Decoders.Code39,
Barkoder.constants.Decoders.Code128,
Barkoder.constants.Decoders.DataMatrix,
Barkoder.constants.Decoders.QR
);
Barkoder.setCameraResolution(Barkoder.constants.CameraResolution.FHD);
Barkoder.setDecodingSpeed(Barkoder.constants.DecodingSpeed.Slow);
Barkoder.setRegionOfInterest(0, 35, 100, 30);
//Only VIN results are returned (only affects Code39)
Barkoder.setEnableVINRestrictions(Barkoder.constants.EnableVINRestrictions.Enable);
Or enable it via configureBarkoder:
let config = new Barkoder.configTypes.BarkoderConfig({
barkoderResolution: Barkoder.constants.CameraResolution.FHD,
decoder: new Barkoder.configTypes.DekoderConfig({
code39: new Barkoder.configTypes.Code39BarcodeConfig({enabled: true, minLength: 0, maxLength: 0, checksum: Barkoder.constants.Code39ChecksumType.disabled}),
code128: new Barkoder.configTypes.BarcodeConfigWithLength({enabled: true, minLength: 0, maxLength: 0}),
datamatrix: new Barkoder.configTypes.DatamatrixBarcodeConfig({
enabled: true,
dpmMode: 1
}),
qr: new Barkoder.configTypes.BarcodeConfig({enabled: true}),
general: new Barkoder.configTypes.GeneralSettings({
decodingSpeed: Barkoder.constants.DecodingSpeed.Slow,
//enableVINRestrictions: true, //this property will be added in next version
roiX: 0,
roiY: 35,
roiWidth: 100,
roiHeight: 30
})
})
});
Barkoder.configureBarkoder(config);
Alternatively, enabling via pre-defined template:
[template.json]
{
"vin": {
"decoder": {
"Code 39": {
"enabled": true,
"minimumLength": 0,
"maximumLength": 0,
"checksum": 0
},
"Code 128": {
"enabled": true,
"minimumLength": 0,
"maximumLength": 0
},
"Datamatrix": {
"enabled": true,
"dpmMode": 0
},
"QR": {
"enabled": true
},
"general": {
"decodingSpeed": 2,
"roi_x": 0,
"roi_y": 35,
"roi_w": 100,
"roi_h": 30,
"enableVINRestrictions": true
}
},
"barkoderResolution": 1
}
}
Barkoder.applyTemplate('template.json', 'vin');