Re: Reading codeBar without text

26 views
Skip to first unread message

Sean Owen

unread,
Mar 5, 2013, 3:56:11 PM3/5/13
to zx...@googlegroups.com
The text has nothing to do with it as it is not read. Some images work some don't. Try TRY_HARDER mode.

Diego Fernando Reyes

unread,
Mar 5, 2013, 4:20:59 PM3/5/13
to zx...@googlegroups.com
now it works ... the problems was my image. thank you 

El martes, 5 de marzo de 2013 15:23:26 UTC-5, Diego Fernando Reyes escribió:

hi 
 i have run a example with zxing for read a bar code type 128. when the code bar has  text, the example shows the info in the code bar. But if the code bar has not a text the info in code bar is not readed. 

with this image it works 

BUT with this other image dont works

My COde is : 

try {
            InputStream barCodeInputStream = null;
            try {
                barCodeInputStream = new FileInputStream("C:\\e.png");
            } catch (FileNotFoundException ex) {
                Logger.getLogger(prueba2.class.getName()).log(Level.SEVERE, null, ex);
            }
            BufferedImage barCodeBufferedImage = ImageIO.read(barCodeInputStream);
            LuminanceSource source = new BufferedImageLuminanceSource(barCodeBufferedImage);
            BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
            Reader reader = new MultiFormatReader();
            Result result = null;
            try {
                result = reader.decode(bitmap);
            } catch (NotFoundException ex) {
                Logger.getLogger(prueba2.class.getName()).log(Level.SEVERE, null, ex);
            } catch (ChecksumException ex) {
                Logger.getLogger(prueba2.class.getName()).log(Level.SEVERE, null, ex);
            } catch (FormatException ex) {
                Logger.getLogger(prueba2.class.getName()).log(Level.SEVERE, null, ex);
            }
            System.out.println("Barcode text is " + result.getText());
        } catch (IOException ex) {
            Logger.getLogger(prueba2.class.getName()).log(Level.SEVERE, null, ex);
        } 
Reply all
Reply to author
Forward
0 new messages