Java Code Examples for com.google.zxing.ResultPoint#distance()

The following examples show how to use com.google.zxing.ResultPoint#distance() . 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 MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
private static float a(ResultPoint aresultpoint[])
{
    return ((ResultPoint.distance(aresultpoint[0], aresultpoint[4]) + ResultPoint.distance(aresultpoint[1], aresultpoint[5])) / 34F + (ResultPoint.distance(aresultpoint[6], aresultpoint[2]) + ResultPoint.distance(aresultpoint[7], aresultpoint[3])) / 36F) / 2.0F;
}
 
Example 2
Source File: Detector.java    From reacteu-app with MIT License 3 votes vote down vote up
/**
 * <p>Estimates module size (pixels in a module) based on the Start and End
 * finder patterns.</p>
 *
 * @param vertices an array of vertices:
 *           vertices[0] x, y top left barcode
 *           vertices[1] x, y bottom left barcode
 *           vertices[2] x, y top right barcode
 *           vertices[3] x, y bottom right barcode
 *           vertices[4] x, y top left codeword area
 *           vertices[5] x, y bottom left codeword area
 *           vertices[6] x, y top right codeword area
 *           vertices[7] x, y bottom right codeword area
 * @return the module size.
 */
private static float computeModuleWidth(ResultPoint[] vertices) {
  float pixels1 = ResultPoint.distance(vertices[0], vertices[4]);
  float pixels2 = ResultPoint.distance(vertices[1], vertices[5]);
  float moduleWidth1 = (pixels1 + pixels2) / (17 * 2.0f);
  float pixels3 = ResultPoint.distance(vertices[6], vertices[2]);
  float pixels4 = ResultPoint.distance(vertices[7], vertices[3]);
  float moduleWidth2 = (pixels3 + pixels4) / (18 * 2.0f);
  return (moduleWidth1 + moduleWidth2) / 2.0f;
}