方法 WhiteRectangleDetector 未为类型 main 定义
The method WhiteRectangleDetector is undefined for the type main
我正在尝试将 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);
我收到此错误消息:方法 WhiteRectangleDetector(BitMatrix) 未定义类型 main!
WhiteRectangleDetector 是一个 class,不是方法。要使用它,您需要使用 new
调用创建它的实例:
WhiteRectangleDetector detector = new WhiteRectangleDetector(bitMatrix);
//now you can call methods
ResultPoint[] wrpts = detector.detect();
我正在尝试将 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);
我收到此错误消息:方法 WhiteRectangleDetector(BitMatrix) 未定义类型 main!
WhiteRectangleDetector 是一个 class,不是方法。要使用它,您需要使用 new
调用创建它的实例:
WhiteRectangleDetector detector = new WhiteRectangleDetector(bitMatrix);
//now you can call methods
ResultPoint[] wrpts = detector.detect();