Can't read blur images

Aperta
#463 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
15/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
csharp

Direzione di ricerca

The reporter's code is in the issue body: a BarcodeReader with AutoRotate, TryHarder and TryInverted set, decoding a Bitmap built by ConvertBase64ToImage from Image.FromStream. The failing image is only linked externally, not in the repository, so first obtain it and reproduce the null result. Done means the sample decodes, or the maintainers explain which preprocessing it needs. The thread has been quiet for about 983 days with no assignee or pull request, so confirm with a maintainer before starting.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
C#
Stelle
3.1k
Fork
704
Merge medio
10g 1h
PR unite (30g)
3

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di micjahn/ZXing.Net

Tutte le issue di micjahn/ZXing.Net

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.