Пример #1
0
  // YUVオブジェクトのバイナリデータを読み込み、マーカーを検知
  public void readYUV(
      final byte[] data,
      int dataWidth,
      int dataHeight,
      int left,
      int top,
      int width,
      int height,
      boolean reserversion) {
    final LuminanceSource source =
        new PlanarYUVLuminanceSource(
            data, dataWidth, dataHeight, left, top, width, height, reserversion);

    final BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(source));
    // final Reader reader = new MultiFormatReader();
    final Reader reader = new QRCodeReader();
    try {
      // 結果をゲット
      mQRResult.setResultData(reader.decode(binaryBitmap));
      mFoundFlag = true;
    }
    // 見つからなかった!
    catch (NotFoundException ex) {
      ex.printStackTrace();
      mFoundFlag = false;
    } catch (ChecksumException ex) {
      ex.printStackTrace();
      mFoundFlag = false;
    } catch (FormatException ex) {
      ex.printStackTrace();
      mFoundFlag = false;
    }
  }
 private Result decodeInternal(BinaryBitmap image) throws NotFoundException {
   if (readers != null) {
     for (Reader reader : readers) {
       try {
         return reader.decode(image, hints);
       } catch (ReaderException re) {
         // continue
       }
     }
   }
   throw NotFoundException.getNotFoundInstance();
 }