对于类型main,未定义WhiteRectangleDetector方法

时间:2017-01-25 09:56:50

标签: java barcode zxing

我正在尝试将WhiteRectangleDetector()函数与带有Java(Eclipse)的zxing库一起使用。我将core-3.3.0.jar和javase-3.3.0.jar添加为User-Library。

LuminanceSource source = new BufferedImageLuminanceSource(barCodeBufferedImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));

Reader reader = new MultiFormatReader();
result = reader.decode(bitmap);
ResultPoint[] scannedCoord = result.getResultPoints();

System.out.println("ResultPoint 1: " + scannedCoord[0]); 
System.out.println("ResultPoint 2: " + scannedCoord[1]);

System.out.println("\n Barcode text is " + result.getText() + "\n");

System.out.println("-------------------------------------------------------------------");

BitMatrix bitMatrix = bitmap.getBlackMatrix();
System.out.println(bitMatrix.getTopLeftOnBit());
System.out.println(bitMatrix.getBottomRightOnBit());

ResultPoint[] wrpts = WhiteRectangleDetector(bitMatrix);

我收到此错误消息:类型main的方法WhiteRectangleDetector(BitMatrix)未定义!

1 个答案:

答案 0 :(得分:0)

WhiteRectangleDetector是一个类,而不是方法。要使用它,您需要使用new调用创建它的实例:

WhiteRectangleDetector detector = new WhiteRectangleDetector(bitMatrix);
//now you can call methods
ResultPoint[] wrpts = detector.detect();