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


C++ ArrayRef::values方法代码示例

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


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

示例1: getWidth

ArrayRef<char> CameraImageWrapper::getMatrix() const
{
    int width = getWidth();
    int height =  getHeight();
    char* matrix = new char[width*height];
    char* m = matrix;

    for(int y=0; y<height; y++)
    {
        ArrayRef<char> tmpRow;
        tmpRow = getRow(y, ArrayRef<char>(width));
#if __cplusplus > 199711L
        memcpy(m, tmpRow->values().data(), width);
#else
		memcpy(m, &tmpRow->values()[0], width);
#endif
        m += width * sizeof(unsigned char);

        //delete tmpRow;
    }

    //pMatrix = matrix;
	ArrayRef<char> arr = ArrayRef<char>(matrix, width*height);

	if(matrix)
		delete matrix;


    return arr;
}
开发者ID:RichardsATcn,项目名称:JasonQt_QRCode,代码行数:30,代码来源:CameraImageWrapper.cpp

示例2: byteCompaction

/**
 * Byte Compaction mode (see 5.4.3) permits all 256 possible 8-bit byte values to be encoded.
 * This includes all ASCII characters value 0 to 127 inclusive and provides for international
 * character set support.
 *
 * @param mode      The byte compaction mode i.e. 901 or 924
 * @param codewords The array of codewords (data + error)
 * @param codeIndex The current index into the codeword array.
 * @param result    The decoded data is appended to the result.
 * @return The next index into the codeword array.
 */
int DecodedBitStreamParser::byteCompaction(int mode,
                                           ArrayRef<int> codewords,
                                           int codeIndex, Ref<String> result) {
  if (mode == BYTE_COMPACTION_MODE_LATCH) {
    // Total number of Byte Compaction characters to be encoded
    // is not a multiple of 6
    int count = 0;
    int64_t value = 0;
    ArrayRef<char> decodedData = new Array<char>(6);
    ArrayRef<int> byteCompactedCodewords = new Array<int>(6);
    bool end = false;
    int nextCode = codewords[codeIndex++];
    while ((codeIndex < codewords[0]) && !end) {
      byteCompactedCodewords[count++] = nextCode;
      // Base 900
      value = 900 * value + nextCode;
      nextCode = codewords[codeIndex++];
      // perhaps it should be ok to check only nextCode >= TEXT_COMPACTION_MODE_LATCH
      if (nextCode == TEXT_COMPACTION_MODE_LATCH ||
          nextCode == BYTE_COMPACTION_MODE_LATCH ||
          nextCode == NUMERIC_COMPACTION_MODE_LATCH ||
          nextCode == BYTE_COMPACTION_MODE_LATCH_6 ||
          nextCode == BEGIN_MACRO_PDF417_CONTROL_BLOCK ||
          nextCode == BEGIN_MACRO_PDF417_OPTIONAL_FIELD ||
          nextCode == MACRO_PDF417_TERMINATOR)
      {
        end = true;
      }
      else
      {
        if ((count%5 == 0) && (count > 0))
        {
          // Decode every 5 codewords
          // Convert to Base 256
          for (int j = 0; j < 6; ++j)
          {
            decodedData[5 - j] = (char) (value%256);
            value >>= 8;
          }
          result->append(string(&(decodedData->values()[0]), decodedData->values().size()));
          count = 0;
        }
      }
    }

    // if the end of all codewords is reached the last codeword needs to be added
    if (codeIndex == codewords[0] && nextCode < TEXT_COMPACTION_MODE_LATCH)
      byteCompactedCodewords[count++] = nextCode;

    // If Byte Compaction mode is invoked with codeword 901,
    // the last group of codewords is interpreted directly
    // as one byte per codeword, without compaction.
    for (int i = 0; i < count; i++)
    {
      result->append((char)byteCompactedCodewords[i]);
    }

  } else if (mode == BYTE_COMPACTION_MODE_LATCH_6) {
开发者ID:HuanGong,项目名称:XReader,代码行数:69,代码来源:PDF417DecodedBitStreamParser.cpp

示例3:

/**
 * @param matrix row of black/white values to search
 * @param column x position to start search
 * @param row y position to start search
 * @param width the number of pixels to search on this row
 * @param pattern pattern of counts of number of black and white pixels that are
 *                 being searched for as a pattern
 * @param counters array of counters, as long as pattern, to re-use
 * @return start/end horizontal offset of guard pattern, as an array of two ints.
 */
ArrayRef<int> Detector::findGuardPattern(Ref<BitMatrix> matrix,
        int column,
        int row,
        int width,
        bool whiteFirst,
        const int pattern[],
        int patternSize,
        ArrayRef<int>& counters) {
    counters->values().assign(counters->size(), 0);
    int patternLength = patternSize;
    bool isWhite = whiteFirst;

    int counterPosition = 0;
    int patternStart = column;
    for (int x = column; x < column + width; x++) {
        bool pixel = matrix->get(x, row);
        if (pixel ^ isWhite) {
            counters[counterPosition]++;
        } else {
            if (counterPosition == patternLength - 1) {
                if (patternMatchVariance(counters, pattern,
                                         MAX_INDIVIDUAL_VARIANCE) < MAX_AVG_VARIANCE) {
                    ArrayRef<int> result = new Array<int>(2);
                    result[0] = patternStart;
                    result[1] = x;
                    return result;
                }
                patternStart += counters[0] + counters[1];
                for(int i = 0; i < patternLength - 2; ++i)
                    counters[i] = counters[ i + 2];
                counters[patternLength - 2] = 0;
                counters[patternLength - 1] = 0;
                counterPosition--;
            } else {
                counterPosition++;
            }
            counters[counterPosition] = 1;
            isWhite = !isWhite;
        }
    }
    return ArrayRef<int>();
}
开发者ID:ComputerVisionWorks,项目名称:QZXing,代码行数:52,代码来源:PDF417Detector.cpp


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