Open petterreinholdtsen opened 3 years ago
Hej @petterreinholdtsen! My OSS project named Koder which is based on zbar 0.23.90 (compiled into WebAssembly) is able to decode this QR. Check out the demo here: https://qr.maslick.tech
Can it also decode it if you give it the image directly, instead of pointing a camera at the image?
For this you need to find the best spot (angle, focus, distance, etc.), which is easier to do live, and not by feeding the algorithm just 1 image, even in great resolution.
Here's a photo sample of your QR code I was able to recognize with Koder:
You can use this snippet and experiment with a number of samples (focus, distance, image quality, resolution):
$ npm i @maslick/koder
$ touch test.js
$ node test.js
const Koder = require('@maslick/koder');
const {loadImage, createCanvas} = require("canvas");
const getImageData = async (src) => {
const img = await loadImage(src);
const canvas = createCanvas(img.width, img.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);
return {
data: ctx.getImageData(0, 0, img.width, img.height).data,
width: img.width,
height: img.height
};
};
(async () => {
const url = 'https://user-images.githubusercontent.com/5644706/152113630-a41fcbdc-3860-4e74-bf39-038bbe37594c.png';
const koder = await new Koder().initialized;
const {data, width, height} = await getImageData(url);
const t0 = new Date().getTime();
const res = koder.decode(data, width, height);
const t1 = new Date().getTime();
console.log(`Scanned in ${t1-t0} ms`); // Scanned in 9 ms
console.log(res); // C+4722222222;50;Test+av+QR-kode+Swish;0
})();
[Pavel Maslov]
For this you need to find the best spot (angle, focus, distance, etc.), which is easier to do live, and not by feeding the algorithm just 1 image, even in great resolution. You can use this script and experiment with a number of samples (focus, distance, image quality):
I was just curious how your program work with one image in perfect focus, as it is the setup I am interested in, ie running QR code detection on prescanned images.
-- Happy hacking Petter Reinholdtsen
I just visited https://www.swish.nu/skapa-qr-kod and created the attached QR code. When I asked zbarimg to give me the QR code content, I got this message instead:
Can zbarimg be improved to recognize this QR code? This was using zbar 0.23.90-1 in Debian Bullseye.