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);
}