You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
There is something wrong with the detector if the default mode is used.
If you switch to PureBarcode mode success will be true in all cases.
Options = new DecodingOptions()
{
PureBarcode = true,
PossibleFormats = new List<BarcodeFormat>()
...
PureBarcode mode should only be used for "synthetic" images. It doesn't work with real-world captured images.
Sorry, I don't have any idea how to fix this.
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.
This produces the output:
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.
The text was updated successfully, but these errors were encountered: