Page 1 of 1

Unstable QR code detection

Posted: Thu Jan 07, 2021 4:01 pm
by emwiceo
Hello guys! Thanks for this masterpiece - H7 board!
I am not satisfied with stability of QR code detector from Examples. Both, zoom and with_lens_correction.
Big low level QR codes printed on paper (more than 2cm rectangle size - see pic attached), but detection stability is very poor.
Only sometimes, not each frame! May be one from ten frames.
In comparison with AprilTags of the same size - Apriltags detector is fantastic!
I tried to tune lens, to change correction factor, distance, to change resolution, windowing! Nothing changes with QR code detection, but AprilTags detection with always remains stable.
As I understand, the problem is intrinsic, in QR code detection algorithm.
Do you know the problem? Please advice me where to look and how to improve?
For my project the QR detection is a key feature.

Re: Unstable QR code detection

Posted: Thu Jan 07, 2021 4:49 pm
by kwagyeman
Hi, you need to have a lot of white space around the edge of the QR codes. They are too close together. Assume that you should have about 1/4 of the width of the QR code as white space on all sides.

Also, they are too close to the edge of the paper.

Re: Unstable QR code detection

Posted: Mon Jan 11, 2021 3:46 pm
by emwiceo
No, the problem is in something else.
Here are single isolated QR code. It is simple, version 1 => its resolution is 21x21 pixels.
Each pixel of QR code overlaps approximately 4 pixels of camera. It is 2 times more then minimum needed by Nyquist theorem. But the detection rate is very low!
So, the camera resolution is not the problem.
It depends on position variation of QR code - I hold camera in my hand. So, if we have a stationary fixture, we will get some dead zones for QR code detection. It is unacceptable for any industrial QR code scanner.
I tested other QR code scanner modules, for example from Marson https://www.marson.com.tw/
This picture also easy to detect with any Android smartphone very far from display.
I want to find a problem and to eliminate it. May be due to jpeg artefacts?
May be we need any image preprocessing?

Re: Unstable QR code detection

Posted: Mon Jan 11, 2021 5:28 pm
by kwagyeman
Our QrCode library is based on quirc: https://github.com/dlbeer/quirc

However, I want to update it to use ZBAR's qrcode module instead.

The code really hasn't receive any love in over 3 years. So, maybe regressions have broken things.

Anyway, can you make the contrast in the image higher? I'll check tonight and see what the performance is. The last time I checked it was working but not amazingly.

Re: Unstable QR code detection

Posted: Tue Jan 12, 2021 3:47 am
by emwiceo
With more light the maximum distance increased in 5-7cm (was 20cm, now 25-27), BUT instability not changed, and persists over the all range of distances.
If I will decrease the distance, the detection quality is not increasing, and stays poor even if the distance is small - pic attached.
I am very interested in reliable QR code detection with OpenMV, if you need any help in correcting and testing, I am ready.

Re: Unstable QR code detection

Posted: Tue Jan 12, 2021 12:22 pm
by kwagyeman
Can you send me a picture of the Qr code that I can print on my printer?

Re: Unstable QR code detection

Posted: Tue Jan 12, 2021 12:23 pm
by kwagyeman
Just to note, the Qr library just might be broken in a way. However, if you are willing to use the system with this in mind I can schedule an upgrade of the code soonish and fix these issues with a new refresh of the qr library. E.g. within 2-3 months.

Re: Unstable QR code detection

Posted: Wed Jan 13, 2021 2:57 pm
by emwiceo
Yes, I need QR detector for my manipulator project, please shedule correction.
QR codes attached.
Thank you!