Error decoding some QR codes with error correction level H
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start from the reproduction in the issue: a BarcodeWriter producing a QR code at QrVersion 6 with ErrorCorrection H, then a BarcodeReader with PossibleFormats set to QR_CODE, using the WIFI string with and without a suffix. Run it at pixel sizes 4 and 8 to confirm the failure, then find which decoder stage rejects the image. Done means that exact string decodes at level H for all pixel sizes, with a regression test covering it.
Written by the indexing model from the issue text.
Description
First of all, thanks for a great library. I have discovered an issue decoding QR codes using error correction level H. I'm running the latest version 0.16.9 from NuGet.
BarcodeWriter writer = new BarcodeWriter()
{
Format = BarcodeFormat.QR_CODE,
};
BarcodeReader reader = new BarcodeReader()
{
Options = new DecodingOptions()
{
PossibleFormats = new List<BarcodeFormat>()
{
BarcodeFormat.QR_CODE,
},
},
};
Trace.WriteLine($"Level\tPixel size\tSuffix\tSuccess");
foreach(ErrorCorrectionLevel level in new[] { ErrorCorrectionLevel.L, ErrorCorrectionLevel.M, ErrorCorrectionLevel.Q, ErrorCorrectionLevel.H })
{
foreach(int pixelSize in new[] { 2, 4, 8 })
{
foreach(string suffix in new[] { "", "suffix" })
{
writer.Options = new QrCodeEncodingOptions()
{
QrVersion = 6,
ErrorCorrection = level,
Width = 49 * pixelSize,
Height = 49 * pixelSize,
};
using Bitmap bmp = writer.Write("WIFI:S:Maskinutbildning;T:WPA;P:fWpzCSgnxe;;" + suffix);
Result result = reader.Decode(bmp);
Trace.WriteLine($"{level}\t{pixelSize}\t{suffix.Length > 0}\t{result != null}");
}
}
}
This produces the output:
Level Pixel size Suffix Success
L 2 False True
L 2 True True
L 4 False True
L 4 True True
L 8 False True
L 8 True True
M 2 False True
M 2 True True
M 4 False True
M 4 True True
M 8 False True
M 8 True True
Q 2 False True
Q 2 True True
Q 4 False True
Q 4 True True
Q 8 False True
Q 8 True True
H 2 False True
H 2 True True
H 4 False False
H 4 True True
H 8 False False
H 8 True True
As you can see, error correction level H is only decoded correctly when using pixel size 2. The strange thing is that if I add some more text to the QR code it decodes fine. Also if I change the password field to something other. So I guess that this exact string creates some difficult pattern in the code.
I tried an online QR code generator with the same string and error correction level H which is also not decoded by ZXing.Net.
- Dominant language
- C#
- Stars
- 3.1k
- Forks
- 704
- Avg merge
- 13d 17h
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from micjahn/ZXing.Net
-
crop() overrides document "0 <= top <= Height"; should be top < Height like left < WidthPossibly taken @hidingmyname claimed this 1 day ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 3/5 Half a day Newbie friendliness 22/100
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
-
Difficulty 4/5 3-5 days Newbie friendliness 12/100
All issues in micjahn/ZXing.Net
Similar issues
-
possible bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Include host.wslc.internal in the HTTPS development certificatePossibly taken @afscrome claimed this today. Openarea-commandlinetools
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dotnet/aspnetcore#70122 · 1 comment ·
Maintainers usually reply within 1 day
-
:1st_place_medal: good first issue :cowboy_hat_face: refactor :roller_coaster: enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ApplETS/Backend-Hello#78 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 2 days
-
status/triage
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Altinn/altinn-studio#21642 ·
Maintainers usually reply within 1 day