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


Java LuminanceSource.getMatrix方法代码示例

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


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

示例1: binarizeEntireImage

import com.google.zxing.LuminanceSource; //导入方法依赖的package包/类
private void binarizeEntireImage() throws NotFoundException {
  if (matrix == null) {
    LuminanceSource source = getLuminanceSource();
    if (source.getWidth() >= MINIMUM_DIMENSION && source.getHeight() >= MINIMUM_DIMENSION) {
      byte[] luminances = source.getMatrix();
      int width = source.getWidth();
      int height = source.getHeight();
      int subWidth = width >> 3;
      if ((width & 0x07) != 0) {
        subWidth++;
      }
      int subHeight = height >> 3;
      if ((height & 0x07) != 0) {
        subHeight++;
      }
      int[][] blackPoints = calculateBlackPoints(luminances, subWidth, subHeight, width, height);

      matrix = new BitMatrix(width, height);
      calculateThresholdForBlock(luminances, subWidth, subHeight, width, height, blackPoints, matrix);
    } else {
      // If the image is too small, fall back to the global histogram approach.
      matrix = super.getBlackMatrix();
    }
  }
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:26,代码来源:HybridBinarizer.java

示例2: getBlackMatrix

import com.google.zxing.LuminanceSource; //导入方法依赖的package包/类
/**
 * Calculates the final BitMatrix once for all requests. This could be called once from the
 * constructor instead, but there are some advantages to doing it lazily, such as making
 * profiling easier, and not doing heavy lifting when callers don't expect it.
 */
@Override
public BitMatrix getBlackMatrix() throws NotFoundException {
  if (matrix != null) {
    return matrix;
  }
  LuminanceSource source = getLuminanceSource();
  int width = source.getWidth();
  int height = source.getHeight();
  if (width >= MINIMUM_DIMENSION && height >= MINIMUM_DIMENSION) {
    byte[] luminances = source.getMatrix();
    int subWidth = width >> BLOCK_SIZE_POWER;
    if ((width & BLOCK_SIZE_MASK) != 0) {
      subWidth++;
    }
    int subHeight = height >> BLOCK_SIZE_POWER;
    if ((height & BLOCK_SIZE_MASK) != 0) {
      subHeight++;
    }
    int[][] blackPoints = calculateBlackPoints(luminances, subWidth, subHeight, width, height);

    BitMatrix newMatrix = new BitMatrix(width, height);
    calculateThresholdForBlock(luminances, subWidth, subHeight, width, height, blackPoints, newMatrix);
    matrix = newMatrix;
  } else {
    // If the image is too small, fall back to the global histogram approach.
    matrix = super.getBlackMatrix();
  }
  return matrix;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:35,代码来源:HybridBinarizer.java

示例3: getBlackMatrix

import com.google.zxing.LuminanceSource; //导入方法依赖的package包/类
public BitMatrix getBlackMatrix() throws NotFoundException {
    int y;
    byte[] localLuminances;
    LuminanceSource source = getLuminanceSource();
    int width = source.getWidth();
    int height = source.getHeight();
    BitMatrix matrix = new BitMatrix(width, height);
    initArrays(width);
    int[] localBuckets = this.buckets;
    for (y = 1; y < 5; y++) {
        int x;
        localLuminances = source.getRow((height * y) / 5, this.luminances);
        int right = (width * 4) / 5;
        for (x = width / 5; x < right; x++) {
            int i = (localLuminances[x] & 255) >> 3;
            localBuckets[i] = localBuckets[i] + 1;
        }
    }
    int blackPoint = estimateBlackPoint(localBuckets);
    localLuminances = source.getMatrix();
    for (y = 0; y < height; y++) {
        int offset = y * width;
        for (x = 0; x < width; x++) {
            if ((localLuminances[offset + x] & 255) < blackPoint) {
                matrix.set(x, y);
            }
        }
    }
    return matrix;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:31,代码来源:GlobalHistogramBinarizer.java

示例4: getBlackMatrix

import com.google.zxing.LuminanceSource; //导入方法依赖的package包/类
public BitMatrix getBlackMatrix() throws NotFoundException {
    if (this.matrix != null) {
        return this.matrix;
    }
    LuminanceSource source = getLuminanceSource();
    int width = source.getWidth();
    int height = source.getHeight();
    if (width < 40 || height < 40) {
        this.matrix = super.getBlackMatrix();
    } else {
        byte[] luminances = source.getMatrix();
        int subWidth = width >> 3;
        if ((width & 7) != 0) {
            subWidth++;
        }
        int subHeight = height >> 3;
        if ((height & 7) != 0) {
            subHeight++;
        }
        int[][] blackPoints = calculateBlackPoints(luminances, subWidth, subHeight, width,
                height);
        BitMatrix newMatrix = new BitMatrix(width, height);
        calculateThresholdForBlock(luminances, subWidth, subHeight, width, height,
                blackPoints, newMatrix);
        this.matrix = newMatrix;
    }
    return this.matrix;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:29,代码来源:HybridBinarizer.java

示例5: getBlackMatrix

import com.google.zxing.LuminanceSource; //导入方法依赖的package包/类
/**
 * Calculates the final BitMatrix once for all requests. This could be called once from the
 * constructor instead, but there are some advantages to doing it lazily, such as making
 * profiling easier, and not doing heavy lifting when callers don't expect it.
 */
@Override
public BitMatrix getBlackMatrix() throws NotFoundException {
    if (matrix != null) {
        return matrix;
    }
    LuminanceSource source = getLuminanceSource();
    int width = source.getWidth();
    int height = source.getHeight();
    if (width >= MINIMUM_DIMENSION && height >= MINIMUM_DIMENSION) {
        byte[] luminances = source.getMatrix();
        int subWidth = width >> BLOCK_SIZE_POWER;
        if ((width & BLOCK_SIZE_MASK) != 0) {
            subWidth++;
        }
        int subHeight = height >> BLOCK_SIZE_POWER;
        if ((height & BLOCK_SIZE_MASK) != 0) {
            subHeight++;
        }
        int[][] blackPoints = calculateBlackPoints(luminances, subWidth, subHeight, width, height);

        BitMatrix newMatrix = new BitMatrix(width, height);
        calculateThresholdForBlock(luminances, subWidth, subHeight, width, height, blackPoints, newMatrix);
        matrix = newMatrix;
    } else {
        // If the image is too small, fall back to the global histogram approach.
        matrix = super.getBlackMatrix();
    }
    return matrix;
}
 
开发者ID:Ag47,项目名称:TrueTone,代码行数:35,代码来源:HybridBinarizer.java

示例6: getBlackMatrix

import com.google.zxing.LuminanceSource; //导入方法依赖的package包/类
public BitMatrix getBlackMatrix()
{
    LuminanceSource luminancesource = getLuminanceSource();
    int i = luminancesource.getWidth();
    int j = luminancesource.getHeight();
    BitMatrix bitmatrix = new BitMatrix(i, j);
    a(i);
    int ai[] = e;
    for (int k = 1; k < 5; k++)
    {
        byte abyte1[] = luminancesource.getRow((j * k) / 5, d);
        int l1 = (i << 2) / 5;
        for (int i2 = i / 5; i2 < l1; i2++)
        {
            int j2 = (0xff & abyte1[i2]) >> 3;
            ai[j2] = 1 + ai[j2];
        }

    }

    int l = a(ai);
    byte abyte0[] = luminancesource.getMatrix();
    for (int i1 = 0; i1 < j; i1++)
    {
        int j1 = i1 * i;
        for (int k1 = 0; k1 < i; k1++)
        {
            if ((0xff & abyte0[j1 + k1]) < l)
            {
                bitmatrix.set(k1, i1);
            }
        }

    }

    return bitmatrix;
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:38,代码来源:GlobalHistogramBinarizer.java

示例7: getBlackMatrix

import com.google.zxing.LuminanceSource; //导入方法依赖的package包/类
public BitMatrix getBlackMatrix()
{
    if (e != null)
    {
        return e;
    }
    LuminanceSource luminancesource = getLuminanceSource();
    if (luminancesource.getWidth() >= 40 && luminancesource.getHeight() >= 40)
    {
        byte abyte0[] = luminancesource.getMatrix();
        int i = luminancesource.getWidth();
        int j = luminancesource.getHeight();
        int k = i >> 3;
        if ((i & 7) != 0)
        {
            k++;
        }
        int l = j >> 3;
        if ((j & 7) != 0)
        {
            l++;
        }
        int ai[][] = a(abyte0, k, l, i, j);
        BitMatrix bitmatrix = new BitMatrix(i, j);
        a(abyte0, k, l, i, j, ai, bitmatrix);
        e = bitmatrix;
    } else
    {
        e = super.getBlackMatrix();
    }
    return e;
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:33,代码来源:HybridBinarizer.java

示例8: getBlackMatrix

import com.google.zxing.LuminanceSource; //导入方法依赖的package包/类
/**
 * Calculates the final BitMatrix once for all requests. This could be
 * called once from the constructor instead, but there are some advantages
 * to doing it lazily, such as making profiling easier, and not doing heavy
 * lifting when callers don't expect it.
 */
@Override
public BitMatrix getBlackMatrix() throws NotFoundException {
	if (matrix != null) {
		return matrix;
	}
	LuminanceSource source = getLuminanceSource();
	int width = source.getWidth();
	int height = source.getHeight();
	if (width >= MINIMUM_DIMENSION && height >= MINIMUM_DIMENSION) {
		byte[] luminances = source.getMatrix();
		int subWidth = width >> BLOCK_SIZE_POWER;
		if ((width & BLOCK_SIZE_MASK) != 0) {
			subWidth++;
		}
		int subHeight = height >> BLOCK_SIZE_POWER;
		if ((height & BLOCK_SIZE_MASK) != 0) {
			subHeight++;
		}
		int[][] blackPoints = calculateBlackPoints(luminances, subWidth, subHeight, width, height);

		BitMatrix newMatrix = new BitMatrix(width, height);
		calculateThresholdForBlock(luminances, subWidth, subHeight, width, height, blackPoints, newMatrix);
		matrix = newMatrix;
	} else {
		// If the image is too small, fall back to the global histogram
		// approach.
		matrix = super.getBlackMatrix();
	}
	return matrix;
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:37,代码来源:HybridBinarizer.java


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