Java Code Examples for com.google.zxing.BinaryBitmap#getBlackMatrix()

The following examples show how to use com.google.zxing.BinaryBitmap#getBlackMatrix() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Detector.java    From ZXing-Orient with Apache License 2.0 6 votes vote down vote up
/**
 * <p>Detects a PDF417 Code in an image. Only checks 0 and 180 degree rotations.</p>
 *
 * @param image barcode image to decode
 * @param hints optional hints to detector
 * @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will
 * be found and returned
 * @return {@link PDF417DetectorResult} encapsulating results of detecting a PDF417 code
 * @throws NotFoundException if no PDF417 Code can be found
 */
public static PDF417DetectorResult detect(BinaryBitmap image, Map<DecodeHintType,?> hints, boolean multiple)
    throws NotFoundException {
  // TODO detection improvement, tryHarder could try several different luminance thresholds/blackpoints or even 
  // different binarizers
  //boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);

  BitMatrix bitMatrix = image.getBlackMatrix();

  List<ResultPoint[]> barcodeCoordinates = detect(multiple, bitMatrix);
  if (barcodeCoordinates.isEmpty()) {
    bitMatrix = bitMatrix.clone();
    bitMatrix.rotate180();
    barcodeCoordinates = detect(multiple, bitMatrix);
  }
  return new PDF417DetectorResult(bitMatrix, barcodeCoordinates);
}
 
Example 2
Source File: Detector.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 6 votes vote down vote up
/**
 * <p>Detects a PDF417 Code in an image. Only checks 0 and 180 degree rotations.</p>
 *
 * @param image barcode image to decode
 * @param hints optional hints to detector
 * @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will
 * be found and returned
 * @return {@link PDF417DetectorResult} encapsulating results of detecting a PDF417 code
 * @throws NotFoundException if no PDF417 Code can be found
 */
public static PDF417DetectorResult detect(BinaryBitmap image, Map<DecodeHintType,?> hints, boolean multiple)
    throws NotFoundException {
  // TODO detection improvement, tryHarder could try several different luminance thresholds/blackpoints or even 
  // different binarizers
  //boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);

  BitMatrix bitMatrix = image.getBlackMatrix();

  List<ResultPoint[]> barcodeCoordinates = detect(multiple, bitMatrix);
  if (barcodeCoordinates.isEmpty()) {
    bitMatrix = bitMatrix.clone();
    bitMatrix.rotate180();
    barcodeCoordinates = detect(multiple, bitMatrix);
  }
  return new PDF417DetectorResult(bitMatrix, barcodeCoordinates);
}
 
Example 3
Source File: Detector.java    From weex with Apache License 2.0 6 votes vote down vote up
/**
 * <p>Detects a PDF417 Code in an image. Only checks 0 and 180 degree rotations.</p>
 *
 * @param image barcode image to decode
 * @param hints optional hints to detector
 * @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will
 * be found and returned
 * @return {@link PDF417DetectorResult} encapsulating results of detecting a PDF417 code
 * @throws NotFoundException if no PDF417 Code can be found
 */
public static PDF417DetectorResult detect(BinaryBitmap image, Map<DecodeHintType,?> hints, boolean multiple)
    throws NotFoundException {
  // TODO detection improvement, tryHarder could try several different luminance thresholds/blackpoints or even 
  // different binarizers
  //boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);

  BitMatrix bitMatrix = image.getBlackMatrix();

  List<ResultPoint[]> barcodeCoordinates = detect(multiple, bitMatrix);
  if (barcodeCoordinates.isEmpty()) {
    bitMatrix = bitMatrix.clone();
    bitMatrix.rotate180();
    barcodeCoordinates = detect(multiple, bitMatrix);
  }
  return new PDF417DetectorResult(bitMatrix, barcodeCoordinates);
}
 
Example 4
Source File: Detector.java    From barcodescanner-lib-aar with MIT License 6 votes vote down vote up
/**
 * <p>Detects a PDF417 Code in an image. Only checks 0 and 180 degree rotations.</p>
 *
 * @param image barcode image to decode
 * @param hints optional hints to detector
 * @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will
 * be found and returned
 * @return {@link PDF417DetectorResult} encapsulating results of detecting a PDF417 code
 * @throws NotFoundException if no PDF417 Code can be found
 */
public static PDF417DetectorResult detect(BinaryBitmap image, Map<DecodeHintType,?> hints, boolean multiple)
    throws NotFoundException {
  // TODO detection improvement, tryHarder could try several different luminance thresholds/blackpoints or even 
  // different binarizers
  //boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);

  BitMatrix bitMatrix = image.getBlackMatrix();

  List<ResultPoint[]> barcodeCoordinates = detect(multiple, bitMatrix);
  if (barcodeCoordinates.isEmpty()) {
    bitMatrix = bitMatrix.clone();
    bitMatrix.rotate180();
    barcodeCoordinates = detect(multiple, bitMatrix);
  }
  return new PDF417DetectorResult(bitMatrix, barcodeCoordinates);
}