com.google.zxing.aztec.AztecDetectorResult Java Examples

The following examples show how to use com.google.zxing.aztec.AztecDetectorResult. 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 reacteu-app with MIT License 6 votes vote down vote up
/**
 * <p>Detects an Aztec Code in an image.</p>
 *
 * @return {@link AztecDetectorResult} encapsulating results of detecting an Aztec Code
 * @throws NotFoundException if no Aztec Code can be found
 */
public AztecDetectorResult detect() throws NotFoundException {

  // 1. Get the center of the aztec matrix
   Point pCenter = getMatrixCenter();

   // 2. Get the corners of the center bull's eye
   Point[] bullEyeCornerPoints = getBullEyeCornerPoints(pCenter);

   // 3. Get the size of the matrix from the bull's eye
  extractParameters(bullEyeCornerPoints);
  
  // 4. Get the corners of the matrix
  ResultPoint[] corners = getMatrixCornerPoints(bullEyeCornerPoints);
  
  // 5. Sample the grid
  BitMatrix bits = sampleGrid(image, corners[shift%4], corners[(shift+3)%4], corners[(shift+2)%4], corners[(shift+1)%4]);
  
  return new AztecDetectorResult(bits, corners, compact, nbDataBlocks, nbLayers);
}
 
Example #2
Source File: Detector.java    From ZXing-Orient with Apache License 2.0 5 votes vote down vote up
/**
 * Detects an Aztec Code in an image.
 *
 * @param isMirror if true, image is a mirror-image of original
 * @return {@link AztecDetectorResult} encapsulating results of detecting an Aztec Code
 * @throws NotFoundException if no Aztec Code can be found
 */
 public AztecDetectorResult detect(boolean isMirror) throws NotFoundException {

  // 1. Get the center of the aztec matrix
  Point pCenter = getMatrixCenter();

  // 2. Get the center points of the four diagonal points just outside the bull's eye
  //  [topRight, bottomRight, bottomLeft, topLeft]
  ResultPoint[] bullsEyeCorners = getBullsEyeCorners(pCenter);

  if (isMirror) {
    ResultPoint temp = bullsEyeCorners[0];
    bullsEyeCorners[0] = bullsEyeCorners[2];
    bullsEyeCorners[2] = temp;
  }

  // 3. Get the size of the matrix and other parameters from the bull's eye
  extractParameters(bullsEyeCorners);
  
  // 4. Sample the grid
  BitMatrix bits = sampleGrid(image,
                              bullsEyeCorners[shift % 4], 
                              bullsEyeCorners[(shift + 1) % 4],
                              bullsEyeCorners[(shift + 2) % 4], 
                              bullsEyeCorners[(shift + 3) % 4]);

  // 5. Get the corners of the matrix.
  ResultPoint[] corners = getMatrixCornerPoints(bullsEyeCorners);
  
  return new AztecDetectorResult(bits, corners, compact, nbDataBlocks, nbLayers);
}
 
Example #3
Source File: Decoder.java    From ZXing-Orient with Apache License 2.0 5 votes vote down vote up
public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException {
  ddata = detectorResult;
  BitMatrix matrix = detectorResult.getBits();
  boolean[] rawbits = extractBits(matrix);
  boolean[] correctedBits = correctBits(rawbits);
  String result = getEncodedData(correctedBits);
  return new DecoderResult(null, result, null, null);
}
 
Example #4
Source File: Detector.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
/**
 * Detects an Aztec Code in an image.
 *
 * @param isMirror if true, image is a mirror-image of original
 * @return {@link AztecDetectorResult} encapsulating results of detecting an Aztec Code
 * @throws NotFoundException if no Aztec Code can be found
 */
 public AztecDetectorResult detect(boolean isMirror) throws NotFoundException {

  // 1. Get the center of the aztec matrix
  Point pCenter = getMatrixCenter();

  // 2. Get the center points of the four diagonal points just outside the bull's eye
  //  [topRight, bottomRight, bottomLeft, topLeft]
  ResultPoint[] bullsEyeCorners = getBullsEyeCorners(pCenter);

  if (isMirror) {
    ResultPoint temp = bullsEyeCorners[0];
    bullsEyeCorners[0] = bullsEyeCorners[2];
    bullsEyeCorners[2] = temp;
  }

  // 3. Get the size of the matrix and other parameters from the bull's eye
  extractParameters(bullsEyeCorners);
  
  // 4. Sample the grid
  BitMatrix bits = sampleGrid(image,
                              bullsEyeCorners[shift % 4], 
                              bullsEyeCorners[(shift + 1) % 4],
                              bullsEyeCorners[(shift + 2) % 4], 
                              bullsEyeCorners[(shift + 3) % 4]);

  // 5. Get the corners of the matrix.
  ResultPoint[] corners = getMatrixCornerPoints(bullsEyeCorners);
  
  return new AztecDetectorResult(bits, corners, compact, nbDataBlocks, nbLayers);
}
 
Example #5
Source File: Decoder.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException {
  ddata = detectorResult;
  BitMatrix matrix = detectorResult.getBits();
  boolean[] rawbits = extractBits(matrix);
  boolean[] correctedBits = correctBits(rawbits);
  String result = getEncodedData(correctedBits);
  return new DecoderResult(null, result, null, null);
}
 
Example #6
Source File: Detector.java    From weex with Apache License 2.0 5 votes vote down vote up
/**
 * Detects an Aztec Code in an image.
 *
 * @param isMirror if true, image is a mirror-image of original
 * @return {@link AztecDetectorResult} encapsulating results of detecting an Aztec Code
 * @throws NotFoundException if no Aztec Code can be found
 */
 public AztecDetectorResult detect(boolean isMirror) throws NotFoundException {

  // 1. Get the center of the aztec matrix
  Point pCenter = getMatrixCenter();

  // 2. Get the center points of the four diagonal points just outside the bull's eye
  //  [topRight, bottomRight, bottomLeft, topLeft]
  ResultPoint[] bullsEyeCorners = getBullsEyeCorners(pCenter);

  if (isMirror) {
    ResultPoint temp = bullsEyeCorners[0];
    bullsEyeCorners[0] = bullsEyeCorners[2];
    bullsEyeCorners[2] = temp;
  }

  // 3. Get the size of the matrix and other parameters from the bull's eye
  extractParameters(bullsEyeCorners);
  
  // 4. Sample the grid
  BitMatrix bits = sampleGrid(image,
                              bullsEyeCorners[shift % 4], 
                              bullsEyeCorners[(shift + 1) % 4],
                              bullsEyeCorners[(shift + 2) % 4], 
                              bullsEyeCorners[(shift + 3) % 4]);

  // 5. Get the corners of the matrix.
  ResultPoint[] corners = getMatrixCornerPoints(bullsEyeCorners);
  
  return new AztecDetectorResult(bits, corners, compact, nbDataBlocks, nbLayers);
}
 
Example #7
Source File: Decoder.java    From weex with Apache License 2.0 5 votes vote down vote up
public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException {
  ddata = detectorResult;
  BitMatrix matrix = detectorResult.getBits();
  boolean[] rawbits = extractBits(matrix);
  boolean[] correctedBits = correctBits(rawbits);
  String result = getEncodedData(correctedBits);
  return new DecoderResult(null, result, null, null);
}
 
Example #8
Source File: Detector.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
/**
 * Detects an Aztec Code in an image.
 *
 * @param isMirror if true, image is a mirror-image of original
 * @return {@link AztecDetectorResult} encapsulating results of detecting an Aztec Code
 * @throws NotFoundException if no Aztec Code can be found
 */
 public AztecDetectorResult detect(boolean isMirror) throws NotFoundException {

  // 1. Get the center of the aztec matrix
  Point pCenter = getMatrixCenter();

  // 2. Get the center points of the four diagonal points just outside the bull's eye
  //  [topRight, bottomRight, bottomLeft, topLeft]
  ResultPoint[] bullsEyeCorners = getBullsEyeCorners(pCenter);

  if (isMirror) {
    ResultPoint temp = bullsEyeCorners[0];
    bullsEyeCorners[0] = bullsEyeCorners[2];
    bullsEyeCorners[2] = temp;
  }

  // 3. Get the size of the matrix and other parameters from the bull's eye
  extractParameters(bullsEyeCorners);
  
  // 4. Sample the grid
  BitMatrix bits = sampleGrid(image,
                              bullsEyeCorners[shift % 4], 
                              bullsEyeCorners[(shift + 1) % 4],
                              bullsEyeCorners[(shift + 2) % 4], 
                              bullsEyeCorners[(shift + 3) % 4]);

  // 5. Get the corners of the matrix.
  ResultPoint[] corners = getMatrixCornerPoints(bullsEyeCorners);
  
  return new AztecDetectorResult(bits, corners, compact, nbDataBlocks, nbLayers);
}
 
Example #9
Source File: Decoder.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException {
  ddata = detectorResult;
  BitMatrix matrix = detectorResult.getBits();
  boolean[] rawbits = extractBits(matrix);
  boolean[] correctedBits = correctBits(rawbits);
  byte[] rawBytes = convertBoolArrayToByteArray(correctedBits);
  String result = getEncodedData(correctedBits);
  DecoderResult decoderResult = new DecoderResult(rawBytes, result, null, null);
  decoderResult.setNumBits(correctedBits.length);
  return decoderResult;
}
 
Example #10
Source File: Detector.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public AztecDetectorResult detect()
{
    b ab[] = a(a());
    a(ab);
    ResultPoint aresultpoint[] = b(ab);
    return new AztecDetectorResult(a(a, aresultpoint[f % 4], aresultpoint[(3 + f) % 4], aresultpoint[(2 + f) % 4], aresultpoint[(1 + f) % 4]), aresultpoint, b, d, c);
}
 
Example #11
Source File: Decoder.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public DecoderResult decode(AztecDetectorResult aztecdetectorresult)
{
    l = aztecdetectorresult;
    BitMatrix bitmatrix = aztecdetectorresult.getBits();
    if (!l.isCompact())
    {
        bitmatrix = b(l.getBits());
    }
    return new DecoderResult(null, a(b(a(bitmatrix))), null, null);
}
 
Example #12
Source File: Detector.java    From ZXing-Orient with Apache License 2.0 4 votes vote down vote up
public AztecDetectorResult detect() throws NotFoundException {
  return detect(false);
}
 
Example #13
Source File: Detector.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
public AztecDetectorResult detect() throws NotFoundException {
  return detect(false);
}
 
Example #14
Source File: Detector.java    From weex with Apache License 2.0 4 votes vote down vote up
public AztecDetectorResult detect() throws NotFoundException {
  return detect(false);
}
 
Example #15
Source File: Detector.java    From barcodescanner-lib-aar with MIT License 4 votes vote down vote up
public AztecDetectorResult detect() throws NotFoundException {
  return detect(false);
}
 
Example #16
Source File: Decoder.java    From reacteu-app with MIT License 4 votes vote down vote up
public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException {
  ddata = detectorResult;
  BitMatrix matrix = detectorResult.getBits();

  if (!ddata.isCompact()) {
    matrix = removeDashedLines(ddata.getBits());
  }

  boolean[] rawbits = extractBits(matrix);

  boolean[] correctedBits = correctBits(rawbits);

  String result = getEncodedData(correctedBits);

  return new DecoderResult(null, result, null, null);
}