2017-01-25 8 views
0

Java(Eclipse)でzxingライブラリでWhiteRectangleDetector()関数を使用しようとしています。私は、User-Libraryとしてcore-3.3.0.jarとjavase-3.3.0.jarを追加しました。WhiteRectangleDetectorメソッドは、メインの型では定義されていません

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)は、メインタイプに定義されていません!

+0

あなたはインポートを修正しませんでしたか? – rkosegi

+0

あなたの輸入はこれを見逃しているかもしれませんか? –

答えて

0

WhiteRectangleDetectorはクラスであり、メソッドではありません。それを使用するには、newの電話でインスタンスを作成する必要があります。

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

あなたは私の日を救った。どうもありがとう! – Rajx82

+0

@ Rajx82よろしくお願いします!答えを忘れないでください(https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) –

関連する問題