Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't read blur images #463

Open
rgolivi opened this issue Nov 14, 2022 · 5 comments
Open

Can't read blur images #463

rgolivi opened this issue Nov 14, 2022 · 5 comments

Comments

@rgolivi
Copy link

rgolivi commented Nov 14, 2022

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

@micjahn
Copy link
Owner

micjahn commented Nov 17, 2022

I fear I can't help here.

@rgolivi
Copy link
Author

rgolivi commented Nov 18, 2022

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

@rob313663
Copy link

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
Copy link

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

@axxel
Copy link

axxel commented Feb 4, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants