當前位置: 首頁>>代碼示例>>Java>>正文


Java ResultPoint.getY方法代碼示例

本文整理匯總了Java中com.google.zxing.ResultPoint.getY方法的典型用法代碼示例。如果您正苦於以下問題:Java ResultPoint.getY方法的具體用法?Java ResultPoint.getY怎麽用?Java ResultPoint.getY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.zxing.ResultPoint的用法示例。


在下文中一共展示了ResultPoint.getY方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sampleLine

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
/**
 * Samples a line.
 *
 * @param p1   start point (inclusive)
 * @param p2   end point (exclusive)
 * @param size number of bits
 * @return the array of bits as an int (first bit is high-order bit of result)
 */
private int sampleLine(ResultPoint p1, ResultPoint p2, int size) {
  int result = 0;

  float d = distance(p1, p2);
  float moduleSize = d / size;
  float px = p1.getX();
  float py = p1.getY();
  float dx = moduleSize * (p2.getX() - p1.getX()) / d;
  float dy = moduleSize * (p2.getY() - p1.getY()) / d;
  for (int i = 0; i < size; i++) {
    if (image.get(MathUtils.round(px + i * dx), MathUtils.round(py + i * dy))) {
      result |= 1 << (size - i - 1);
    }
  }
  return result;
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:25,代碼來源:Detector.java

示例2: createTransform

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
private static PerspectiveTransform createTransform(ResultPoint topLeft, ResultPoint
        topRight, ResultPoint bottomLeft, ResultPoint alignmentPattern, int dimension) {
    float bottomRightX;
    float bottomRightY;
    float sourceBottomRightX;
    float sourceBottomRightY;
    float dimMinusThree = ((float) dimension) - 3.5f;
    if (alignmentPattern != null) {
        bottomRightX = alignmentPattern.getX();
        bottomRightY = alignmentPattern.getY();
        sourceBottomRightX = dimMinusThree - IPhotoView.DEFAULT_MAX_SCALE;
        sourceBottomRightY = sourceBottomRightX;
    } else {
        bottomRightX = (topRight.getX() - topLeft.getX()) + bottomLeft.getX();
        bottomRightY = (topRight.getY() - topLeft.getY()) + bottomLeft.getY();
        sourceBottomRightX = dimMinusThree;
        sourceBottomRightY = dimMinusThree;
    }
    return PerspectiveTransform.quadrilateralToQuadrilateral(3.5f, 3.5f, dimMinusThree, 3.5f,
            sourceBottomRightX, sourceBottomRightY, 3.5f, dimMinusThree, topLeft.getX(),
            topLeft.getY(), topRight.getX(), topRight.getY(), bottomRightX, bottomRightY,
            bottomLeft.getX(), bottomLeft.getY());
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:24,代碼來源:Detector.java

示例3: translateResultPoints

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
private static Result translateResultPoints(Result result, int xOffset, int yOffset) {
  ResultPoint[] oldResultPoints = result.getResultPoints();
  if (oldResultPoints == null) {
    return result;
  }
  ResultPoint[] newResultPoints = new ResultPoint[oldResultPoints.length];
  for (int i = 0; i < oldResultPoints.length; i++) {
    ResultPoint oldPoint = oldResultPoints[i];
    if (oldPoint != null) {
      newResultPoints[i] = new ResultPoint(oldPoint.getX() + xOffset, oldPoint.getY() + yOffset);
    }
  }
  Result newResult = new Result(result.getText(), result.getRawBytes(), newResultPoints, result.getBarcodeFormat());
  newResult.putAllMetadata(result.getResultMetadata());
  return newResult;
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:17,代碼來源:GenericMultipleBarcodeReader.java

示例4: getRowIndicatorColumn

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
private static DetectionResultRowIndicatorColumn getRowIndicatorColumn(BitMatrix image,
                                                                       BoundingBox boundingBox,
                                                                       ResultPoint startPoint,
                                                                       boolean leftToRight,
                                                                       int minCodewordWidth,
                                                                       int maxCodewordWidth) {
  DetectionResultRowIndicatorColumn rowIndicatorColumn = new DetectionResultRowIndicatorColumn(boundingBox,
      leftToRight);
  for (int i = 0; i < 2; i++) {
    int increment = i == 0 ? 1 : -1;
    int startColumn = (int) startPoint.getX();
    for (int imageRow = (int) startPoint.getY(); imageRow <= boundingBox.getMaxY() &&
        imageRow >= boundingBox.getMinY(); imageRow += increment) {
      Codeword codeword = detectCodeword(image, 0, image.getWidth(), leftToRight, startColumn, imageRow,
          minCodewordWidth, maxCodewordWidth);
      if (codeword != null) {
        rowIndicatorColumn.setCodeword(imageRow, codeword);
        if (leftToRight) {
          startColumn = codeword.getStartX();
        } else {
          startColumn = codeword.getEndX();
        }
      }
    }
  }
  return rowIndicatorColumn;
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:28,代碼來源:PDF417ScanningDecoder.java

示例5: addMissingRows

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
BoundingBox addMissingRows(int missingStartRows, int missingEndRows, boolean isLeft) throws NotFoundException {
  ResultPoint newTopLeft = topLeft;
  ResultPoint newBottomLeft = bottomLeft;
  ResultPoint newTopRight = topRight;
  ResultPoint newBottomRight = bottomRight;

  if (missingStartRows > 0) {
    ResultPoint top = isLeft ? topLeft : topRight;
    int newMinY = (int) top.getY() - missingStartRows;
    if (newMinY < 0) {
      newMinY = 0;
    }
    ResultPoint newTop = new ResultPoint(top.getX(), newMinY);
    if (isLeft) {
      newTopLeft = newTop;
    } else {
      newTopRight = newTop;
    }
  }

  if (missingEndRows > 0) {
    ResultPoint bottom = isLeft ? bottomLeft : bottomRight;
    int newMaxY = (int) bottom.getY() + missingEndRows;
    if (newMaxY >= image.getHeight()) {
      newMaxY = image.getHeight() - 1;
    }
    ResultPoint newBottom = new ResultPoint(bottom.getX(), newMaxY);
    if (isLeft) {
      newBottomLeft = newBottom;
    } else {
      newBottomRight = newBottom;
    }
  }

  calculateMinMaxValues();
  return new BoundingBox(image, newTopLeft, newBottomLeft, newTopRight, newBottomRight);
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:38,代碼來源:BoundingBox.java

示例6: correctTopRight

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
/**
 * Calculates the position of the white top right module using the output of the rectangle detector
 * for a square matrix
 */
private ResultPoint correctTopRight(ResultPoint bottomLeft,
                                    ResultPoint bottomRight,
                                    ResultPoint topLeft,
                                    ResultPoint topRight,
                                    int dimension) {

  float corr = distance(bottomLeft, bottomRight) / (float) dimension;
  int norm = distance(topLeft, topRight);
  float cos = (topRight.getX() - topLeft.getX()) / norm;
  float sin = (topRight.getY() - topLeft.getY()) / norm;

  ResultPoint c1 = new ResultPoint(topRight.getX() + corr * cos, topRight.getY() + corr * sin);

  corr = distance(bottomLeft, topLeft) / (float) dimension;
  norm = distance(bottomRight, topRight);
  cos = (topRight.getX() - bottomRight.getX()) / norm;
  sin = (topRight.getY() - bottomRight.getY()) / norm;

  ResultPoint c2 = new ResultPoint(topRight.getX() + corr * cos, topRight.getY() + corr * sin);

  if (!isValid(c1)) {
    if (isValid(c2)) {
      return c2;
    }
    return null;
  }
  if (!isValid(c2)) {
    return c1;
  }

  int l1 = Math.abs(transitionsBetween(topLeft, c1).getTransitions() -
                    transitionsBetween(bottomRight, c1).getTransitions());
  int l2 = Math.abs(transitionsBetween(topLeft, c2).getTransitions() -
                    transitionsBetween(bottomRight, c2).getTransitions());

  return l1 <= l2 ? c1 : c2;
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:42,代碼來源:Detector.java

示例7: centerEdges

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
/**
 * recenters the points of a constant distance towards the center
 *
 * @param y bottom most point
 * @param z left most point
 * @param x right most point
 * @param t top most point
 * @return {@link ResultPoint}[] describing the corners of the rectangular
 *         region. The first and last points are opposed on the diagonal, as
 *         are the second and third. The first point will be the topmost
 *         point and the last, the bottommost. The second point will be
 *         leftmost and the third, the rightmost
 */
private ResultPoint[] centerEdges(ResultPoint y, ResultPoint z,
                                  ResultPoint x, ResultPoint t) {

  //
  //       t            t
  //  z                      x
  //        x    OR    z
  //   y                    y
  //

  float yi = y.getX();
  float yj = y.getY();
  float zi = z.getX();
  float zj = z.getY();
  float xi = x.getX();
  float xj = x.getY();
  float ti = t.getX();
  float tj = t.getY();

  if (yi < width / 2.0f) {
    return new ResultPoint[]{
        new ResultPoint(ti - CORR, tj + CORR),
        new ResultPoint(zi + CORR, zj + CORR),
        new ResultPoint(xi - CORR, xj - CORR),
        new ResultPoint(yi + CORR, yj - CORR)};
  } else {
    return new ResultPoint[]{
        new ResultPoint(ti + CORR, tj + CORR),
        new ResultPoint(zi + CORR, zj - CORR),
        new ResultPoint(xi - CORR, xj + CORR),
        new ResultPoint(yi - CORR, yj - CORR)};
  }
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:47,代碼來源:WhiteRectangleDetector.java

示例8: detect

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
/**
 * <p>Detects a rectangular region of black and white -- mostly black -- with a region of mostly
 * white, in an image.</p>
 *
 * @return {@link ResultPoint}[] describing the corners of the rectangular region. The first and
 *  last points are opposed on the diagonal, as are the second and third. The first point will be
 *  the topmost point and the last, the bottommost. The second point will be leftmost and the
 *  third, the rightmost
 * @throws NotFoundException if no Data Matrix Code can be found
 */
public ResultPoint[] detect() throws NotFoundException {
  int height = image.getHeight();
  int width = image.getWidth();
  int halfHeight = height / 2;
  int halfWidth = width / 2;
  int deltaY = Math.max(1, height / (MAX_MODULES * 8));
  int deltaX = Math.max(1, width / (MAX_MODULES * 8));

  int top = 0;
  int bottom = height;
  int left = 0;
  int right = width;
  ResultPoint pointA = findCornerFromCenter(halfWidth, 0, left, right,
      halfHeight, -deltaY, top, bottom, halfWidth / 2);
  top = (int) pointA.getY() - 1;
  ResultPoint pointB = findCornerFromCenter(halfWidth, -deltaX, left, right,
      halfHeight, 0, top, bottom, halfHeight / 2);
  left = (int) pointB.getX() - 1;
  ResultPoint pointC = findCornerFromCenter(halfWidth, deltaX, left, right,
      halfHeight, 0, top, bottom, halfHeight / 2);
  right = (int) pointC.getX() + 1;
  ResultPoint pointD = findCornerFromCenter(halfWidth, 0, left, right,
      halfHeight, deltaY, top, bottom, halfWidth / 2);
  bottom = (int) pointD.getY() + 1;

  // Go try to find point A again with better information -- might have been off at first.
  pointA = findCornerFromCenter(halfWidth, 0, left, right,
      halfHeight, -deltaY, top, bottom, halfWidth / 4);

  return new ResultPoint[] { pointA, pointB, pointC, pointD };
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:42,代碼來源:MonochromeRectangleDetector.java

示例9: makeAbsolute

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
private static void makeAbsolute(ResultPoint[] points, int leftOffset, int topOffset) {
  if (points != null) {
    for (int i = 0; i < points.length; i++) {
      ResultPoint relative = points[i];
      points[i] = new ResultPoint(relative.getX() + leftOffset, relative.getY() + topOffset);
    }
  }
}
 
開發者ID:10045125,項目名稱:QrCode,代碼行數:9,代碼來源:ByQuadrantReader.java

示例10: getRowIndicatorColumn

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
private static DetectionResultRowIndicatorColumn getRowIndicatorColumn(BitMatrix image,
                                                                       BoundingBox
                                                                               boundingBox,
                                                                       ResultPoint
                                                                               startPoint,
                                                                       boolean leftToRight,
                                                                       int minCodewordWidth,
                                                                       int maxCodewordWidth) {
    DetectionResultRowIndicatorColumn rowIndicatorColumn = new
            DetectionResultRowIndicatorColumn(boundingBox, leftToRight);
    int i = 0;
    while (i < 2) {
        int increment = i == 0 ? 1 : -1;
        int startColumn = (int) startPoint.getX();
        int imageRow = (int) startPoint.getY();
        while (imageRow <= boundingBox.getMaxY() && imageRow >= boundingBox.getMinY()) {
            Codeword codeword = detectCodeword(image, 0, image.getWidth(), leftToRight,
                    startColumn, imageRow, minCodewordWidth, maxCodewordWidth);
            if (codeword != null) {
                rowIndicatorColumn.setCodeword(imageRow, codeword);
                if (leftToRight) {
                    startColumn = codeword.getStartX();
                } else {
                    startColumn = codeword.getEndX();
                }
            }
            imageRow += increment;
        }
        i++;
    }
    return rowIndicatorColumn;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:33,代碼來源:PDF417ScanningDecoder.java

示例11: addMissingRows

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
BoundingBox addMissingRows(int missingStartRows, int missingEndRows, boolean isLeft) throws
        NotFoundException {
    ResultPoint newTopLeft = this.topLeft;
    ResultPoint newBottomLeft = this.bottomLeft;
    ResultPoint newTopRight = this.topRight;
    ResultPoint newBottomRight = this.bottomRight;
    if (missingStartRows > 0) {
        ResultPoint top = isLeft ? this.topLeft : this.topRight;
        int newMinY = ((int) top.getY()) - missingStartRows;
        if (newMinY < 0) {
            newMinY = 0;
        }
        ResultPoint newTop = new ResultPoint(top.getX(), (float) newMinY);
        if (isLeft) {
            newTopLeft = newTop;
        } else {
            newTopRight = newTop;
        }
    }
    if (missingEndRows > 0) {
        ResultPoint bottom = isLeft ? this.bottomLeft : this.bottomRight;
        int newMaxY = ((int) bottom.getY()) + missingEndRows;
        if (newMaxY >= this.image.getHeight()) {
            newMaxY = this.image.getHeight() - 1;
        }
        ResultPoint newBottom = new ResultPoint(bottom.getX(), (float) newMaxY);
        if (isLeft) {
            newBottomLeft = newBottom;
        } else {
            newBottomRight = newBottom;
        }
    }
    calculateMinMaxValues();
    return new BoundingBox(this.image, newTopLeft, newBottomLeft, newTopRight, newBottomRight);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:36,代碼來源:BoundingBox.java

示例12: correctTopRightRectangular

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
private ResultPoint correctTopRightRectangular(ResultPoint bottomLeft, ResultPoint
        bottomRight, ResultPoint topLeft, ResultPoint topRight, int dimensionTop, int
        dimensionRight) {
    float corr = ((float) distance(bottomLeft, bottomRight)) / ((float) dimensionTop);
    int norm = distance(topLeft, topRight);
    ResultPoint c1 = new ResultPoint(topRight.getX() + (corr * ((topRight.getX() - topLeft
            .getX()) / ((float) norm))), topRight.getY() + (corr * ((topRight.getY() -
            topLeft.getY()) / ((float) norm))));
    corr = ((float) distance(bottomLeft, topLeft)) / ((float) dimensionRight);
    norm = distance(bottomRight, topRight);
    ResultPoint c2 = new ResultPoint(topRight.getX() + (corr * ((topRight.getX() -
            bottomRight.getX()) / ((float) norm))), topRight.getY() + (corr * ((topRight.getY
            () - bottomRight.getY()) / ((float) norm))));
    if (isValid(c1)) {
        if (!isValid(c2)) {
            return c1;
        }
        if (Math.abs(dimensionTop - transitionsBetween(topLeft, c1).getTransitions()) + Math
                .abs(dimensionRight - transitionsBetween(bottomRight, c1).getTransitions())
                <= Math.abs(dimensionTop - transitionsBetween(topLeft, c2).getTransitions())
                + Math.abs(dimensionRight - transitionsBetween(bottomRight, c2)
                .getTransitions())) {
            return c1;
        }
        return c2;
    } else if (isValid(c2)) {
        return c2;
    } else {
        return null;
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:32,代碼來源:Detector.java

示例13: createTransform

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
private static PerspectiveTransform createTransform(ResultPoint topLeft,
                                                    ResultPoint topRight,
                                                    ResultPoint bottomLeft,
                                                    ResultPoint alignmentPattern,
                                                    int dimension) {
  float dimMinusThree = (float) dimension - 3.5f;
  float bottomRightX;
  float bottomRightY;
  float sourceBottomRightX;
  float sourceBottomRightY;
  if (alignmentPattern != null) {
    bottomRightX = alignmentPattern.getX();
    bottomRightY = alignmentPattern.getY();
    sourceBottomRightX = dimMinusThree - 3.0f;
    sourceBottomRightY = sourceBottomRightX;
  } else {
    // Don't have an alignment pattern, just make up the bottom-right point
    bottomRightX = (topRight.getX() - topLeft.getX()) + bottomLeft.getX();
    bottomRightY = (topRight.getY() - topLeft.getY()) + bottomLeft.getY();
    sourceBottomRightX = dimMinusThree;
    sourceBottomRightY = dimMinusThree;
  }

  return PerspectiveTransform.quadrilateralToQuadrilateral(
      3.5f,
      3.5f,
      dimMinusThree,
      3.5f,
      sourceBottomRightX,
      sourceBottomRightY,
      3.5f,
      dimMinusThree,
      topLeft.getX(),
      topLeft.getY(),
      topRight.getX(),
      topRight.getY(),
      bottomRightX,
      bottomRightY,
      bottomLeft.getX(),
      bottomLeft.getY());
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:42,代碼來源:Detector.java

示例14: correctTopRightRectangular

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
/**
 * Calculates the position of the white top right module using the output of the rectangle detector
 * for a rectangular matrix
 */
private ResultPoint correctTopRightRectangular(ResultPoint bottomLeft,
                                               ResultPoint bottomRight,
                                               ResultPoint topLeft,
                                               ResultPoint topRight,
                                               int dimensionTop,
                                               int dimensionRight) {

  float corr = distance(bottomLeft, bottomRight) / (float)dimensionTop;
  int norm = distance(topLeft, topRight);
  float cos = (topRight.getX() - topLeft.getX()) / norm;
  float sin = (topRight.getY() - topLeft.getY()) / norm;

  ResultPoint c1 = new ResultPoint(topRight.getX()+corr*cos, topRight.getY()+corr*sin);

  corr = distance(bottomLeft, topLeft) / (float)dimensionRight;
  norm = distance(bottomRight, topRight);
  cos = (topRight.getX() - bottomRight.getX()) / norm;
  sin = (topRight.getY() - bottomRight.getY()) / norm;

  ResultPoint c2 = new ResultPoint(topRight.getX()+corr*cos, topRight.getY()+corr*sin);

  if (!isValid(c1)) {
    if (isValid(c2)) {
      return c2;
    }
    return null;
  }
  if (!isValid(c2)){
    return c1;
  }

  int l1 = Math.abs(dimensionTop - transitionsBetween(topLeft, c1).getTransitions()) +
        Math.abs(dimensionRight - transitionsBetween(bottomRight, c1).getTransitions());
  int l2 = Math.abs(dimensionTop - transitionsBetween(topLeft, c2).getTransitions()) +
  Math.abs(dimensionRight - transitionsBetween(bottomRight, c2).getTransitions());

  if (l1 <= l2){
    return c1;
  }

  return c2;
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:47,代碼來源:Detector.java

示例15: doDecodeMultiple

import com.google.zxing.ResultPoint; //導入方法依賴的package包/類
private void doDecodeMultiple(BinaryBitmap image, Map<DecodeHintType, ?> hints, List<Result>
        results, int xOffset, int yOffset, int currentDepth) {
    if (currentDepth <= 4) {
        try {
            Result result = this.delegate.decode(image, hints);
            boolean alreadyFound = false;
            for (Result existingResult : results) {
                if (existingResult.getText().equals(result.getText())) {
                    alreadyFound = true;
                    break;
                }
            }
            if (!alreadyFound) {
                results.add(translateResultPoints(result, xOffset, yOffset));
            }
            ResultPoint[] resultPoints = result.getResultPoints();
            if (resultPoints != null && resultPoints.length != 0) {
                int width = image.getWidth();
                int height = image.getHeight();
                float minX = (float) width;
                float minY = (float) height;
                float maxX = 0.0f;
                float maxY = 0.0f;
                for (ResultPoint point : resultPoints) {
                    if (point != null) {
                        float x = point.getX();
                        float y = point.getY();
                        if (x < minX) {
                            minX = x;
                        }
                        if (y < minY) {
                            minY = y;
                        }
                        if (x > maxX) {
                            maxX = x;
                        }
                        if (y > maxY) {
                            maxY = y;
                        }
                    }
                }
                if (minX > 100.0f) {
                    doDecodeMultiple(image.crop(0, 0, (int) minX, height), hints, results,
                            xOffset, yOffset, currentDepth + 1);
                }
                if (minY > 100.0f) {
                    doDecodeMultiple(image.crop(0, 0, width, (int) minY), hints, results,
                            xOffset, yOffset, currentDepth + 1);
                }
                if (maxX < ((float) (width - 100))) {
                    doDecodeMultiple(image.crop((int) maxX, 0, width - ((int) maxX), height),
                            hints, results, xOffset + ((int) maxX), yOffset, currentDepth + 1);
                }
                if (maxY < ((float) (height - 100))) {
                    doDecodeMultiple(image.crop(0, (int) maxY, width, height - ((int) maxY)),
                            hints, results, xOffset, yOffset + ((int) maxY), currentDepth + 1);
                }
            }
        } catch (ReaderException e) {
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:63,代碼來源:GenericMultipleBarcodeReader.java


注:本文中的com.google.zxing.ResultPoint.getY方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。