shaken-qr-reader
is a library to read/parse Japanese 車検証
QR code
npm install shaken-qr-reader --save
yarn add shaken-qr-reader
You can find the script URL from https://www.jsdelivr.com/package/npm/shaken-qr-reader
const images = ... // common ImageData type objects. You can get from cameras or uploaded files etc...
const reader = new ShakenQRReader();
// const reader = new ShakenQRReader('kei'); for 軽自動車 has 6 QR codes
// const reader = new ShakenQRReader('kei_old'); for 軽自動車 has 3 QR codes
images.forEach((image) => {
try {
reader.push(image);
} catch (error) {
if (error instanceof InvalidQRCode) {
console.log("The image is not valid shaken QR code.");
} else if (error instanceof ReadQRCocde) {
console.log("The image is already read.");
}
}
});
console.log(reader.isCompleted); // Whether all the QR codes are read or not
console.log(reader.missingIndex); // Indexs for the QR code which is not read
console.log(reader.result);
see example directory for real usage.
yarn
yarn test
yarn lint
see LICENSE