I'm trying to use ngx barcode scanner to scan barcodes with different formats using device's camera. User should be able to scan barcode without knowing which format it is (code 39, code 128 and i2of5 are the most common).
When passing all possible formats to barcode-scanner-livestream scanner is reading multiple different values, and recognizes multiple different barcode types. Scanner works fine when I manually determine the code type, but I can not expect users to know which type they are scanning.
As an example:
Here's the barcode I want to read: Code-39 example with encoded value 0123456789A
Here are some results from scanning:
codeResult:
code: "06104201"
decodedCodes: (8) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
direction: -1
end: 41
format: "upc_e"
start: 159
startInfo: {error: 0.4761904761904762, start: 72, end: 86}
codeResult:
code: "3150161490817"
decodedCodes: (15) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
direction: -1
end: 201
format: "ean_13"
start: 445
startInfo: {error: 0.3333333333333333, start: 121, end: 129}
codeResult:
code: "0123456789A"
decodedCodes: (11) ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A']
direction: -1
end: 0
format: "code_39"
start: 549
startInfo: {start: 19, end: 54}
So the 3rd one was the correct one. I was wondering if I could use error prop from startInfo to determine if reading is correct? Seems like it's not present if barcode was identified correctly. Or is there any other way to check if scan was accurate and barcode type was recognized.
Versions I'm using:
- ngx-barcode-scanner 0.3.0
- quagga2 1.4.2
- Angular 12.2.17