当前位置: 首页>>代码示例>>Java>>正文


Java BitArray.isRange方法代码示例

本文整理汇总了Java中com.google.zxing.common.BitArray.isRange方法的典型用法代码示例。如果您正苦于以下问题:Java BitArray.isRange方法的具体用法?Java BitArray.isRange怎么用?Java BitArray.isRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.zxing.common.BitArray的用法示例。


在下文中一共展示了BitArray.isRange方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findStartGuardPattern

import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
static int[] findStartGuardPattern(BitArray row) throws NotFoundException {
  boolean foundStart = false;
  int[] startRange = null;
  int nextStart = 0;
  int[] counters = new int[START_END_PATTERN.length];
  while (!foundStart) {
    Arrays.fill(counters, 0, START_END_PATTERN.length, 0);
    startRange = findGuardPattern(row, nextStart, false, START_END_PATTERN, counters);
    int start = startRange[0];
    nextStart = startRange[1];
    // Make sure there is a quiet zone at least as big as the start pattern before the barcode.
    // If this check would run off the left edge of the image, do not accept this barcode,
    // as it is very likely to be a false positive.
    int quietStart = start - (nextStart - start);
    if (quietStart >= 0) {
      foundStart = row.isRange(quietStart, start, false);
    }
  }
  return startRange;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:21,代码来源:UPCEANReader.java

示例2: findStartGuardPattern

import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
static int[] findStartGuardPattern(BitArray row) throws NotFoundException {
    boolean foundStart = false;
    int[] startRange = null;
    int nextStart = 0;
    int[] counters = new int[START_END_PATTERN.length];
    while (!foundStart) {
        Arrays.fill(counters, 0, START_END_PATTERN.length, 0);
        startRange = findGuardPattern(row, nextStart, false, START_END_PATTERN, counters);
        int start = startRange[0];
        nextStart = startRange[1];
        int quietStart = start - (nextStart - start);
        if (quietStart >= 0) {
            foundStart = row.isRange(quietStart, start, false);
        }
    }
    return startRange;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:UPCEANReader.java

示例3: findAsteriskPattern

import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
private static int[] findAsteriskPattern(BitArray row, int[] counters) throws NotFoundException {
  int width = row.getSize();
  int rowOffset = row.getNextSet(0);

  int counterPosition = 0;
  int patternStart = rowOffset;
  boolean isWhite = false;
  int patternLength = counters.length;

  for (int i = rowOffset; i < width; i++) {
    if (row.get(i) ^ isWhite) {
      counters[counterPosition]++;
    } else {
      if (counterPosition == patternLength - 1) {
        // Look for whitespace before start pattern, >= 50% of width of start pattern
        if (toNarrowWidePattern(counters) == ASTERISK_ENCODING &&
            row.isRange(Math.max(0, patternStart - ((i - patternStart) / 2)), patternStart, false)) {
          return new int[]{patternStart, i};
        }
        patternStart += counters[0] + counters[1];
        System.arraycopy(counters, 2, counters, 0, patternLength - 2);
        counters[patternLength - 2] = 0;
        counters[patternLength - 1] = 0;
        counterPosition--;
      } else {
        counterPosition++;
      }
      counters[counterPosition] = 1;
      isWhite = !isWhite;
    }
  }
  throw NotFoundException.getNotFoundInstance();
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:34,代码来源:Code39Reader.java

示例4: findAsteriskPattern

import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
private static int[] findAsteriskPattern(BitArray row, int[] counters) throws
        NotFoundException {
    int width = row.getSize();
    int rowOffset = row.getNextSet(0);
    int counterPosition = 0;
    int patternStart = rowOffset;
    boolean isWhite = false;
    int patternLength = counters.length;
    int i = rowOffset;
    while (i < width) {
        if ((row.get(i) ^ isWhite) != 0) {
            counters[counterPosition] = counters[counterPosition] + 1;
        } else {
            if (counterPosition != patternLength - 1) {
                counterPosition++;
            } else if (toNarrowWidePattern(counters) == ASTERISK_ENCODING && row.isRange(Math
                    .max(0, patternStart - ((i - patternStart) / 2)), patternStart, false)) {
                return new int[]{patternStart, i};
            } else {
                patternStart += counters[0] + counters[1];
                System.arraycopy(counters, 2, counters, 0, patternLength - 2);
                counters[patternLength - 2] = 0;
                counters[patternLength - 1] = 0;
                counterPosition--;
            }
            counters[counterPosition] = 1;
            if (isWhite) {
                isWhite = false;
            } else {
                isWhite = true;
            }
        }
        i++;
    }
    throw NotFoundException.getNotFoundInstance();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:37,代码来源:Code39Reader.java

示例5: findAsteriskPattern

import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
private static int[] findAsteriskPattern(BitArray row, int[] counters) throws NotFoundException {
  int width = row.getSize();
  int rowOffset = row.getNextSet(0);

  int counterPosition = 0;
  int patternStart = rowOffset;
  boolean isWhite = false;
  int patternLength = counters.length;

  for (int i = rowOffset; i < width; i++) {
    if (row.get(i) != isWhite) {
      counters[counterPosition]++;
    } else {
      if (counterPosition == patternLength - 1) {
        // Look for whitespace before start pattern, >= 50% of width of start pattern
        if (toNarrowWidePattern(counters) == ASTERISK_ENCODING &&
            row.isRange(Math.max(0, patternStart - ((i - patternStart) / 2)), patternStart, false)) {
          return new int[]{patternStart, i};
        }
        patternStart += counters[0] + counters[1];
        System.arraycopy(counters, 2, counters, 0, counterPosition - 1);
        counters[counterPosition - 1] = 0;
        counters[counterPosition] = 0;
        counterPosition--;
      } else {
        counterPosition++;
      }
      counters[counterPosition] = 1;
      isWhite = !isWhite;
    }
  }
  throw NotFoundException.getNotFoundInstance();
}
 
开发者ID:simplezhli,项目名称:Tesseract-OCR-Scanner,代码行数:34,代码来源:Code39Reader.java

示例6: findStartPattern

import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
private static int[] findStartPattern(BitArray row) throws NotFoundException {
  int width = row.getSize();
  int rowOffset = row.getNextSet(0);

  int counterPosition = 0;
  int[] counters = new int[6];
  int patternStart = rowOffset;
  boolean isWhite = false;
  int patternLength = counters.length;

  for (int i = rowOffset; i < width; i++) {
    if (row.get(i) ^ isWhite) {
      counters[counterPosition]++;
    } else {
      if (counterPosition == patternLength - 1) {
        float bestVariance = MAX_AVG_VARIANCE;
        int bestMatch = -1;
        for (int startCode = CODE_START_A; startCode <= CODE_START_C; startCode++) {
          float variance = patternMatchVariance(counters, CODE_PATTERNS[startCode],
              MAX_INDIVIDUAL_VARIANCE);
          if (variance < bestVariance) {
            bestVariance = variance;
            bestMatch = startCode;
          }
        }
        // Look for whitespace before start pattern, >= 50% of width of start pattern
        if (bestMatch >= 0 &&
            row.isRange(Math.max(0, patternStart - (i - patternStart) / 2), patternStart, false)) {
          return new int[]{patternStart, i, bestMatch};
        }
        patternStart += counters[0] + counters[1];
        System.arraycopy(counters, 2, counters, 0, patternLength - 2);
        counters[patternLength - 2] = 0;
        counters[patternLength - 1] = 0;
        counterPosition--;
      } else {
        counterPosition++;
      }
      counters[counterPosition] = 1;
      isWhite = !isWhite;
    }
  }
  throw NotFoundException.getNotFoundInstance();
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:45,代码来源:Code128Reader.java

示例7: findStartPattern

import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
private static int[] findStartPattern(BitArray row) throws NotFoundException {
    int width = row.getSize();
    int rowOffset = row.getNextSet(0);
    int counterPosition = 0;
    int[] counters = new int[6];
    int patternStart = rowOffset;
    boolean isWhite = false;
    int patternLength = counters.length;
    int i = rowOffset;
    while (i < width) {
        if ((row.get(i) ^ isWhite) != 0) {
            counters[counterPosition] = counters[counterPosition] + 1;
        } else {
            if (counterPosition == patternLength - 1) {
                float bestVariance = 0.25f;
                int bestMatch = -1;
                for (int startCode = 103; startCode <= 105; startCode++) {
                    float variance = OneDReader.patternMatchVariance(counters,
                            CODE_PATTERNS[startCode], MAX_INDIVIDUAL_VARIANCE);
                    if (variance < bestVariance) {
                        bestVariance = variance;
                        bestMatch = startCode;
                    }
                }
                if (bestMatch < 0 || !row.isRange(Math.max(0, patternStart - ((i -
                        patternStart) / 2)), patternStart, false)) {
                    patternStart += counters[0] + counters[1];
                    System.arraycopy(counters, 2, counters, 0, patternLength - 2);
                    counters[patternLength - 2] = 0;
                    counters[patternLength - 1] = 0;
                    counterPosition--;
                } else {
                    return new int[]{patternStart, i, bestMatch};
                }
            }
            counterPosition++;
            counters[counterPosition] = 1;
            isWhite = !isWhite;
        }
        i++;
    }
    throw NotFoundException.getNotFoundInstance();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:44,代码来源:Code128Reader.java

示例8: findStartPattern

import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
private static int[] findStartPattern(BitArray row) throws NotFoundException {
  int width = row.getSize();
  int rowOffset = row.getNextSet(0);

  int counterPosition = 0;
  int[] counters = new int[6];
  int patternStart = rowOffset;
  boolean isWhite = false;
  int patternLength = counters.length;

  for (int i = rowOffset; i < width; i++) {
    if (row.get(i) != isWhite) {
      counters[counterPosition]++;
    } else {
      if (counterPosition == patternLength - 1) {
        float bestVariance = MAX_AVG_VARIANCE;
        int bestMatch = -1;
        for (int startCode = CODE_START_A; startCode <= CODE_START_C; startCode++) {
          float variance = patternMatchVariance(counters, CODE_PATTERNS[startCode],
              MAX_INDIVIDUAL_VARIANCE);
          if (variance < bestVariance) {
            bestVariance = variance;
            bestMatch = startCode;
          }
        }
        // Look for whitespace before start pattern, >= 50% of width of start pattern
        if (bestMatch >= 0 &&
            row.isRange(Math.max(0, patternStart - (i - patternStart) / 2), patternStart, false)) {
          return new int[]{patternStart, i, bestMatch};
        }
        patternStart += counters[0] + counters[1];
        System.arraycopy(counters, 2, counters, 0, counterPosition - 1);
        counters[counterPosition - 1] = 0;
        counters[counterPosition] = 0;
        counterPosition--;
      } else {
        counterPosition++;
      }
      counters[counterPosition] = 1;
      isWhite = !isWhite;
    }
  }
  throw NotFoundException.getNotFoundInstance();
}
 
开发者ID:simplezhli,项目名称:Tesseract-OCR-Scanner,代码行数:45,代码来源:Code128Reader.java


注:本文中的com.google.zxing.common.BitArray.isRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。