Using Zxing I tried to get barcode value from input image. I used the below code for getting barcode value.
BufferedImage img = ImageIO.read(new File("C:/Demo_Project/Project/input.jpeg"));
BufferedImage subimage = img.getSubimage(350, 300, 600, 600); // Since few posts mentioned like if filesize exceeds Zxing not works properly. I get subimage of barcode part from actual image.
LuminanceSource source = new BufferedImageLuminanceSource(subimage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Reader reader = new MultiFormatReader();
Result result = reader.decode(bitmap);
System.out.println("Barcode is ::"+result.getText());
Getting below exception,
com.google.zxing.NotFoundException .
Any fixes or other straight forward approaches to get barcode value from image files. My iamge files are actually taken in mobile camera which sizes close to 8MB. After getting subimage it become 4 to 10 KB still my image is not recognized properly. Any help would be appreciated.
Of course, I have verified the sub-image contains the barcode. Please see the attachment.