ZXing.Net icon indicating copy to clipboard operation
ZXing.Net copied to clipboard

Can't read blur images

Open rgolivi opened this issue 3 years ago • 5 comments

Hi @micjahn, Unable to read the blurry type images using zxing.net dll and below is my code and blur image base64 data:

image

string scannedData = "Here I have base64 of the image";

Image image = ConvertBase64ToImage(scannedData); Bitmap bitmap = (Bitmap)image;

BarcodeReader barcodeReader = new BarcodeReader{ AutoRotate = true }; barcodeReader.Options.TryHarder = true; barcodeReader.Options.TryInverted = true; Result barcodeResult = barcodeReader.Decode(bitmap); if (barcodeResult != null) { Console.WriteLine("BarCode Result - BarCode Text is: " + barcodeResult.Text + " ; BarCode Format is: " + barcodeResult.BarcodeFormat.ToString()); } else { Console.WriteLine("BarCode Result is null"); }

private static Image ConvertBase64ToImage(string base64string) { try { byte[] imageBytes = Convert.FromBase64String(base64string); MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length); //Convert byte[] to Image ms.Write(imageBytes, 0, imageBytes.Length); Image image = Image.FromStream(ms, true); ms.Dispose(); return image; } catch (OutOfMemoryException ex) { Console.WriteLine($"Memory Out of Exception occured while converting base64 to Image and Message is : {ex.Message} & stack trace: {ex.StackTrace}"); return null; } catch (Exception ex) { Console.WriteLine($"Exception occured while converting base64 to Image and Message is : {ex.Message} & stack trace: {ex.StackTrace}"); return null; } }

Colud you help me on this how to Decode this type of images.

Thanks, Rajesh

rgolivi avatar Nov 14 '22 13:11 rgolivi

I fear I can't help here.

micjahn avatar Nov 17 '22 17:11 micjahn

Hi @micjahn,

I have attached my image(which is not detecting as PatchT). Could you help me on this blur type images how to decode it.

cbimage (6)

Regards, Rajesh

rgolivi avatar Nov 18 '22 06:11 rgolivi

It is a Code 39 containing PATCHT, It can be read with a Zebra TC52 Android device with a 2D Imager. I think it is a contrast issue, the black bars are too grey.

rob313663 avatar Sep 23 '23 19:09 rob313663

And it is stupid having ornamental bars and spaces at the edges of a document containing a barcode. LOL!

rob313663 avatar Sep 23 '23 19:09 rob313663

Since @micjahn said, there is nothing to be done to make this work in ZXing.Net, I'll allow myself to the new .NET wrapper of the zxing-cpp port that decodes both of the above images just fine.

axxel avatar Feb 04 '24 22:02 axxel