C# :Zxing Variation of the first number?

Asked

Viewed 143 times

1

People I developed this barcode reader in C# using Zxing , it reads the barcode of an img and then it takes the image number , moves the image to another folder and renames the image with the barcode number

            //Esse é o método pra ler a imagem
            Bitmap image;`


            image = (Bitmap)Bitmap.FromFile(recebe);

            LuminanceSource source;
            source = new BitmapLuminanceSource(image);
            BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
            Result result = new MultiFormatReader().decodeWithState(bitmap);

            //faz um condicional para ler o que existe dentro da matriz Barcode
            foreach (string code in result)
            {

                if (!Directory.Exists(nomePasta.ToString()))
                {
                    Directory.CreateDirectory(nomePasta.ToString());
                }
                else 
                { 

                }

                if (codigo == 0)
                {
                    codigo = Convert.ToInt32(0 + code);

                    File.Move(stringCaminho.ToString(), nomePasta.ToString() + code + ".bmp");
                }

                else if (codigo + 0 > Convert.ToInt32(0 + code))
                {
                    MessageBox.Show("Código de barras está errado! "+code);
                }

                dataGridView1.Rows.Add(code);
                //esta dando erro para fazer o Move da segunda referencia


                }


                }

The problem is that when he reads the barcode he always brings the first wrong number, and the others he brings it right, which I can do?

  • Based on what are you saying the first number is wrong? What format is identified (Result Barcodeformat property ?

  • The code is working . beauty , however it does not read the right first number . It will dll error even ?

  • I think it might be a problem in the library. I downloaded a reader for Windows Phone based on this library and it gives several random results. It’s very inconsistent.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.