Unstable QR code detection

Discussion related to "under the hood" OpenMV topics.
emwiceo
Posts: 4
Joined: Thu Jan 07, 2021 3:35 pm

Unstable QR code detection

Postby emwiceo » Thu Jan 07, 2021 4:01 pm

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.
Attachments
IMG_20210107_235952.jpg
User avatar
kwagyeman
Posts: 4851
Joined: Sun May 24, 2015 2:10 pm

Re: Unstable QR code detection

Postby kwagyeman » Thu Jan 07, 2021 4:49 pm

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.
Nyamekye,
emwiceo
Posts: 4
Joined: Thu Jan 07, 2021 3:35 pm

Re: Unstable QR code detection

Postby emwiceo » Mon Jan 11, 2021 3:46 pm

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?
Attachments
qr-single.jpg
User avatar
kwagyeman
Posts: 4851
Joined: Sun May 24, 2015 2:10 pm

Re: Unstable QR code detection

Postby kwagyeman » Mon Jan 11, 2021 5:28 pm

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.
Nyamekye,
emwiceo
Posts: 4
Joined: Thu Jan 07, 2021 3:35 pm

Re: Unstable QR code detection

Postby emwiceo » Tue Jan 12, 2021 3:47 am

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.
Attachments
qr-single2.jpg
User avatar
kwagyeman
Posts: 4851
Joined: Sun May 24, 2015 2:10 pm

Re: Unstable QR code detection

Postby kwagyeman » Tue Jan 12, 2021 12:22 pm

Can you send me a picture of the Qr code that I can print on my printer?
Nyamekye,
User avatar
kwagyeman
Posts: 4851
Joined: Sun May 24, 2015 2:10 pm

Re: Unstable QR code detection

Postby kwagyeman » Tue Jan 12, 2021 12:23 pm

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.
Nyamekye,
emwiceo
Posts: 4
Joined: Thu Jan 07, 2021 3:35 pm

Re: Unstable QR code detection

Postby emwiceo » Wed Jan 13, 2021 2:57 pm

Yes, I need QR detector for my manipulator project, please shedule correction.
QR codes attached.
Thank you!
Attachments
q1.png
q1.png (416 Bytes) Viewed 26 times
q0.png
q0.png (420 Bytes) Viewed 26 times

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest