当前位置: 首页>>代码示例>>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;未经允许,请勿转载。