I'm new with java. I can't open the source.
I have downloaded JBarcode-Recognition-0.10.jar from http://public.planetmirror.com/pub/sourceforge/j/jb/jbarcode-scan/
So, I have try to start with code founded in the forum.
(http://sourceforge.net/forum/forum.php?thread_id=1626013&forum_id=415607)
I get :
Scanning a page
Processing Barcode
Average = 1.6666666666666667
...
Average = 1.25
Average = 1.25
Invalid barcode
Hello.
I'm new with java. I can't open the source.
I have downloaded JBarcode-Recognition-0.10.jar from http://public.planetmirror.com/pub/sourceforge/j/jb/jbarcode-scan/
So, I have try to start with code founded in the forum.
(http://sourceforge.net/forum/forum.php?thread_id=1626013&forum_id=415607)
I get :
Scanning a page
Processing Barcode
Average = 1.6666666666666667
...
Average = 1.25
Average = 1.25
Invalid barcode
With few barcodes ean13.
code :
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import uk.org.JBarcode_Recognition.JBarcode_Recognition;
import uk.org.JBarcode_Recognition.Barcodes.Barcode;
/**
* @author Jim Tupper
* @author Andi Mclean
*
*/
public class jwebcam10 {
private BufferedImage _image = null;
public BufferedImage getImage() {
return _image;
}
public jwebcam10() {
//Load a test image:
try {
String fileName = "barcode-sample1.jpg";
Toolkit toolKit = java.awt.Toolkit.getDefaultToolkit();
Image image = ImageIO.read(new File(fileName));
_image = new BufferedImage(image.getWidth(null), image.getHeight(null),
BufferedImage.TYPE_INT_RGB);
Graphics2D big = _image.createGraphics();
big.drawImage(image, 0, 0, null);
big.dispose();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
System.out.println("Scanning a page");
jwebcam10 barcodeScan = new jwebcam10();
System.out.println("Processing Barcode");
Barcode barcode = null;
barcode = _getScannerBook_EAN13(barcodeScan);
System.out.println(barcode);
}
private static Barcode _getScannerBook_EAN13(jwebcam10 barcodeScan) {
Barcode barcode;
barcode = JBarcode_Recognition.GetBarcode(barcodeScan.getImage(),
new Rectangle(barcodeScan.getImage().getWidth(),
barcodeScan.getImage().getHeight()),
0.25,
JBarcode_Recognition.HORIZONTAL,
JBarcode_Recognition.NO_COLOUR_INVERT,
JBarcode_Recognition.NO_DIRECTION_REVERSE,
Barcode.BT_AUTO);
return barcode;
}
}
Thanks in advance