本文整理汇总了C#中com.google.zxing.common.BitMatrix类的典型用法代码示例。如果您正苦于以下问题:C# com.google.zxing.common.BitMatrix类的具体用法?C# com.google.zxing.common.BitMatrix怎么用?C# com.google.zxing.common.BitMatrix使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
com.google.zxing.common.BitMatrix类属于命名空间,在下文中一共展示了com.google.zxing.common.BitMatrix类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FinderPatternFinder
public FinderPatternFinder(BitMatrix image, ResultPointCallback resultPointCallback)
{
this.image = image;
this.possibleCenters = new System.Collections.Generic.List<Object>(10);
this.crossCheckStateCount = new int[5];
this.resultPointCallback = resultPointCallback;
}
开发者ID:fsalinasna,项目名称:MyInventory,代码行数:7,代码来源:FinderPatternFinder.cs
示例2: FinderPatternFinder
public FinderPatternFinder(BitMatrix image, ResultPointCallback resultPointCallback)
{
this.image = image;
this.possibleCenters = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
this.crossCheckStateCount = new int[5];
this.resultPointCallback = resultPointCallback;
}
开发者ID:pockees,项目名称:ZXing-CSharp,代码行数:7,代码来源:FinderPatternFinder.cs
示例3: BitMatrixParser
/// <param name="bitMatrix"> <seealso cref="BitMatrix"/> to parse </param>
/// <exception cref="FormatException"> if dimension is not >= 21 and 1 mod 4 </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: BitMatrixParser(com.google.zxing.common.BitMatrix bitMatrix) throws com.google.zxing.FormatException
internal BitMatrixParser(BitMatrix bitMatrix)
{
int dimension = bitMatrix.Height;
if (dimension < 21 || (dimension & 0x03) != 1)
{
throw FormatException.FormatInstance;
}
this.bitMatrix = bitMatrix;
}
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:13,代码来源:BitMatrixParser.cs
示例4: BitMatrixParser
/// <param name="bitMatrix">{@link BitMatrix} to parse
/// </param>
/// <throws> ReaderException if dimension is not >= 21 and 1 mod 4 </throws>
internal BitMatrixParser(BitMatrix bitMatrix)
{
int dimension = bitMatrix.Dimension;
if (dimension < 21 || (dimension & 0x03) != 1)
{
throw ReaderException.Instance;
}
this.bitMatrix = bitMatrix;
}
开发者ID:jaychouzhou,项目名称:Ydifisofidosfj,代码行数:12,代码来源:BitMatrixParser.cs
示例5: BitMatrixParser
/// <param name="bitMatrix">{@link BitMatrix} to parse
/// </param>
/// <throws> ReaderException if dimension is not >= 21 and 1 mod 4 </throws>
internal BitMatrixParser(BitMatrix bitMatrix)
{
int dimension = bitMatrix.Dimension;
if (dimension < 21 || (dimension & 0x03) != 1)
{
throw new Exception("ReaderException");
}
this.bitMatrix = bitMatrix;
}
开发者ID:tomcat1234,项目名称:WebQRReader,代码行数:12,代码来源:BitMatrixParser.cs
示例6: BitMatrixParser
/// <param name="bitMatrix"> <seealso cref="BitMatrix"/> to parse </param>
/// <exception cref="FormatException"> if dimension is < 8 or > 144 or not 0 mod 2 </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: BitMatrixParser(com.google.zxing.common.BitMatrix bitMatrix) throws com.google.zxing.FormatException
internal BitMatrixParser(BitMatrix bitMatrix)
{
int dimension = bitMatrix.Height;
if (dimension < 8 || dimension > 144 || (dimension & 0x01) != 0)
{
throw FormatException.FormatInstance;
}
version = readVersion(bitMatrix);
this.mappingBitMatrix = extractDataRegion(bitMatrix);
this.readMappingMatrix = new BitMatrix(this.mappingBitMatrix.Width, this.mappingBitMatrix.Height);
}
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:16,代码来源:BitMatrixParser.cs
示例7: AlignmentPatternFinder
/// <summary>
/// <p>Creates a finder that will look in a portion of the whole image.</p>
/// </summary>
/// <param name="image"> image to search </param>
/// <param name="startX"> left column from which to start searching </param>
/// <param name="startY"> top row from which to start searching </param>
/// <param name="width"> width of region to search </param>
/// <param name="height"> height of region to search </param>
/// <param name="moduleSize"> estimated module size so far </param>
internal AlignmentPatternFinder(BitMatrix image, int startX, int startY, int width, int height, float moduleSize, ResultPointCallback resultPointCallback)
{
this.image = image;
this.possibleCenters = new List<AlignmentPattern>(5);
this.startX = startX;
this.startY = startY;
this.width = width;
this.height = height;
this.moduleSize = moduleSize;
this.crossCheckStateCount = new int[3];
this.resultPointCallback = resultPointCallback;
}
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:21,代码来源:AlignmentPatternFinder.cs
示例8: AlignmentPatternFinder
/// <summary> <p>Creates a finder that will look in a portion of the whole image.</p>
///
/// </summary>
/// <param name="image">image to search
/// </param>
/// <param name="startX">left column from which to start searching
/// </param>
/// <param name="startY">top row from which to start searching
/// </param>
/// <param name="width">width of region to search
/// </param>
/// <param name="height">height of region to search
/// </param>
/// <param name="moduleSize">estimated module size so far
/// </param>
internal AlignmentPatternFinder(BitMatrix image, int startX, int startY, int width, int height, float moduleSize, ResultPointCallback resultPointCallback)
{
this.image = image;
this.possibleCenters = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(5));
this.startX = startX;
this.startY = startY;
this.width = width;
this.height = height;
this.moduleSize = moduleSize;
this.crossCheckStateCount = new int[3];
this.resultPointCallback = resultPointCallback;
}
开发者ID:noikiy,项目名称:Webcam.Net-QR-Decoder,代码行数:27,代码来源:AlignmentPatternFinder.cs
示例9: BitMatrixParser
/// <param name="bitMatrix">{@link BitMatrix} to parse
/// </param>
/// <throws> ReaderException if dimension is < 10 or > 144 or not 0 mod 2 </throws>
internal BitMatrixParser(BitMatrix bitMatrix)
{
int dimension = bitMatrix.Dimension;
if (dimension < 10 || dimension > 144 || (dimension & 0x01) != 0)
{
throw new Exception("ReaderException");
}
version = readVersion(bitMatrix);
this.mappingBitMatrix = extractDataRegion(bitMatrix);
// TODO(bbrown): Make this work for rectangular symbols
this.readMappingMatrix = BitMatrix.CreateSquareInstance(this.mappingBitMatrix.Dimension);
}
开发者ID:tomcat1234,项目名称:WebQRReader,代码行数:16,代码来源:BitMatrixParser.cs
示例10: unmaskBitMatrix
/// <summary>
/// <p>Implementations of this method reverse the data masking process applied to a QR Code and
/// make its bits ready to read.</p>
/// </summary>
/// <param name="bits"> representation of QR Code bits </param>
/// <param name="dimension"> dimension of QR Code, represented by bits, being unmasked </param>
internal void unmaskBitMatrix(BitMatrix bits, int dimension)
{
for (int i = 0; i < dimension; i++)
{
for (int j = 0; j < dimension; j++)
{
if (isMasked(i, j))
{
bits.flip(j, i);
}
}
}
}
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:19,代码来源:DataMask.cs
示例11: readVersion
/// <summary> <p>Creates the version object based on the dimension of the original bit matrix from
/// the datamatrix code.</p>
///
/// <p>See ISO 16022:2006 Table 7 - ECC 200 symbol attributes</p>
///
/// </summary>
/// <param name="bitMatrix">Original {@link BitMatrix} including alignment patterns
/// </param>
/// <returns> {@link Version} encapsulating the Data Matrix Code's "version"
/// </returns>
/// <throws> ReaderException if the dimensions of the mapping matrix are not valid </throws>
/// <summary> Data Matrix dimensions.
/// </summary>
internal Version readVersion(BitMatrix bitMatrix)
{
if (version != null)
{
return version;
}
// TODO(bbrown): make this work for rectangular dimensions as well.
int numRows = bitMatrix.Dimension;
int numColumns = numRows;
return Version.getVersionForDimensions(numRows, numColumns);
}
开发者ID:noikiy,项目名称:Webcam.Net-QR-Decoder,代码行数:27,代码来源:BitMatrixParser.cs
示例12: decode
/// <summary>
/// <p>Convenience method that can decode a QR Code represented as a 2D array of booleans.
/// "true" is taken to mean a black module.</p>
/// </summary>
/// <param name="image"> booleans representing white/black QR Code modules </param>
/// <returns> text and bytes encoded within the QR Code </returns>
/// <exception cref="FormatException"> if the QR Code cannot be decoded </exception>
/// <exception cref="ChecksumException"> if error correction fails </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public com.google.zxing.common.DecoderResult decode(boolean[][] image, java.util.Map<com.google.zxing.DecodeHintType,?> hints) throws com.google.zxing.ChecksumException, com.google.zxing.FormatException
public DecoderResult decode(bool[][] image, IDictionary<DecodeHintType, object> hints)
{
int dimension = image.Length;
BitMatrix bits = new BitMatrix(dimension);
for (int i = 0; i < dimension; i++)
{
for (int j = 0; j < dimension; j++)
{
if (image[i][j])
{
bits.set(j, i);
}
}
}
return decode(bits, hints);
}
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:26,代码来源:Decoder.cs
示例13: decode
/// <summary> <p>Convenience method that can decode a Data Matrix Code represented as a 2D array of booleans.
/// "true" is taken to mean a black module.</p>
///
/// </summary>
/// <param name="image">booleans representing white/black Data Matrix Code modules
/// </param>
/// <returns> text and bytes encoded within the Data Matrix Code
/// </returns>
/// <throws> ReaderException if the Data Matrix Code cannot be decoded </throws>
public DecoderResult decode(bool[][] image)
{
int dimension = image.Length;
BitMatrix bits = new BitMatrix(dimension);
for (int i = 0; i < dimension; i++)
{
for (int j = 0; j < dimension; j++)
{
if (image[i][j])
{
bits.set_Renamed(j, i);
}
}
}
return decode(bits);
}
开发者ID:hheeralal,项目名称:LoyalAZ-Mobile,代码行数:25,代码来源:Decoder.cs
示例14: extractDataRegion
/// <summary> <p>Extracts the data region from a {@link BitMatrix} that contains
/// alignment patterns.</p>
///
/// </summary>
/// <param name="bitMatrix">Original {@link BitMatrix} with alignment patterns
/// </param>
/// <returns> BitMatrix that has the alignment patterns removed
/// </returns>
internal BitMatrix extractDataRegion(BitMatrix bitMatrix)
{
int symbolSizeRows = version.SymbolSizeRows;
int symbolSizeColumns = version.SymbolSizeColumns;
// TODO(bbrown): Make this work with rectangular codes
if (bitMatrix.Dimension != symbolSizeRows)
{
throw new Exception("ArgumentException: Dimension of bitMarix must match the version size");
}
int dataRegionSizeRows = version.DataRegionSizeRows;
int dataRegionSizeColumns = version.DataRegionSizeColumns;
int numDataRegionsRow = Math.Floor(symbolSizeRows / dataRegionSizeRows);
int numDataRegionsColumn = Math.Floor(symbolSizeColumns / dataRegionSizeColumns);
int sizeDataRegionRow = numDataRegionsRow * dataRegionSizeRows;
//int sizeDataRegionColumn = numDataRegionsColumn * dataRegionSizeColumns;
// TODO(bbrown): Make this work with rectangular codes
BitMatrix bitMatrixWithoutAlignment = BitMatrix.CreateSquareInstance(sizeDataRegionRow);
for (int dataRegionRow = 0; dataRegionRow < numDataRegionsRow; ++dataRegionRow)
{
int dataRegionRowOffset = dataRegionRow * dataRegionSizeRows;
for (int dataRegionColumn = 0; dataRegionColumn < numDataRegionsColumn; ++dataRegionColumn)
{
int dataRegionColumnOffset = dataRegionColumn * dataRegionSizeColumns;
for (int i = 0; i < dataRegionSizeRows; ++i)
{
int readRowOffset = dataRegionRow * (dataRegionSizeRows + 2) + 1 + i;
int writeRowOffset = dataRegionRowOffset + i;
for (int j = 0; j < dataRegionSizeColumns; ++j)
{
int readColumnOffset = dataRegionColumn * (dataRegionSizeColumns + 2) + 1 + j;
if (bitMatrix.get_Renamed(readColumnOffset, readRowOffset))
{
int writeColumnOffset = dataRegionColumnOffset + j;
bitMatrixWithoutAlignment.set_Renamed(writeColumnOffset, writeRowOffset);
}
}
}
}
}
return bitMatrixWithoutAlignment;
}
开发者ID:tomcat1234,项目名称:WebQRReader,代码行数:54,代码来源:BitMatrixParser.cs
示例15: extractDataRegion
/// <summary>
/// <p>Extracts the data region from a <seealso cref="BitMatrix"/> that contains
/// alignment patterns.</p>
/// </summary>
/// <param name="bitMatrix"> Original <seealso cref="BitMatrix"/> with alignment patterns </param>
/// <returns> BitMatrix that has the alignment patterns removed </returns>
internal BitMatrix extractDataRegion(BitMatrix bitMatrix)
{
int symbolSizeRows = version.SymbolSizeRows;
int symbolSizeColumns = version.SymbolSizeColumns;
if (bitMatrix.Height != symbolSizeRows)
{
throw new System.ArgumentException("Dimension of bitMarix must match the version size");
}
int dataRegionSizeRows = version.DataRegionSizeRows;
int dataRegionSizeColumns = version.DataRegionSizeColumns;
int numDataRegionsRow = symbolSizeRows / dataRegionSizeRows;
int numDataRegionsColumn = symbolSizeColumns / dataRegionSizeColumns;
int sizeDataRegionRow = numDataRegionsRow * dataRegionSizeRows;
int sizeDataRegionColumn = numDataRegionsColumn * dataRegionSizeColumns;
BitMatrix bitMatrixWithoutAlignment = new BitMatrix(sizeDataRegionColumn, sizeDataRegionRow);
for (int dataRegionRow = 0; dataRegionRow < numDataRegionsRow; ++dataRegionRow)
{
int dataRegionRowOffset = dataRegionRow * dataRegionSizeRows;
for (int dataRegionColumn = 0; dataRegionColumn < numDataRegionsColumn; ++dataRegionColumn)
{
int dataRegionColumnOffset = dataRegionColumn * dataRegionSizeColumns;
for (int i = 0; i < dataRegionSizeRows; ++i)
{
int readRowOffset = dataRegionRow * (dataRegionSizeRows + 2) + 1 + i;
int writeRowOffset = dataRegionRowOffset + i;
for (int j = 0; j < dataRegionSizeColumns; ++j)
{
int readColumnOffset = dataRegionColumn * (dataRegionSizeColumns + 2) + 1 + j;
if (bitMatrix.get(readColumnOffset, readRowOffset))
{
int writeColumnOffset = dataRegionColumnOffset + j;
bitMatrixWithoutAlignment.set(writeColumnOffset, writeRowOffset);
}
}
}
}
}
return bitMatrixWithoutAlignment;
}
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:50,代码来源:BitMatrixParser.cs
示例16: decode
/// <summary> <p>Decodes a PDF417 Code represented as a {@link BitMatrix}.
/// A 1 or "true" is taken to mean a black module.</p>
///
/// </summary>
/// <param name="bits">booleans representing white/black PDF417 Code modules
/// </param>
/// <returns> text and bytes encoded within the PDF417 Code
/// </returns>
/// <throws> ReaderException if the PDF417 Code cannot be decoded </throws>
public DecoderResult decode(BitMatrix bits)
{
// Construct a parser to read the data codewords and error-correction level
BitMatrixParser parser = new BitMatrixParser(bits);
int[] codewords = parser.readCodewords();
if (codewords == null || codewords.Length == 0)
{
throw ReaderException.Instance;
}
int ecLevel = parser.ECLevel;
int numECCodewords = 1 << (ecLevel + 1);
int[] erasures = parser.Erasures;
correctErrors(codewords, erasures, numECCodewords);
verifyCodewordCount(codewords, numECCodewords);
// Decode the codewords
return DecodedBitStreamParser.decode(codewords);
}
开发者ID:noikiy,项目名称:Webcam.Net-QR-Decoder,代码行数:29,代码来源:Decoder.cs
示例17: decode
/// <summary> <p>Decodes a QR Code represented as a {@link BitMatrix}. A 1 or "true" is taken to mean a black module.</p>
///
/// </summary>
/// <param name="bits">booleans representing white/black QR Code modules
/// </param>
/// <returns> text and bytes encoded within the QR Code
/// </returns>
/// <throws> ReaderException if the QR Code cannot be decoded </throws>
public DecoderResult decode(BitMatrix bits)
{
// Construct a parser and read version, error-correction level
BitMatrixParser parser = new BitMatrixParser(bits);
Version version = parser.readVersion();
ErrorCorrectionLevel ecLevel = parser.readFormatInformation().ErrorCorrectionLevel;
// Read codewords
sbyte[] codewords = parser.readCodewords();
// Separate into data blocks
DataBlock[] dataBlocks = DataBlock.getDataBlocks(codewords, version, ecLevel);
// Count total number of data bytes
int totalBytes = 0;
for (int i = 0; i < dataBlocks.Length; i++)
{
totalBytes += dataBlocks[i].NumDataCodewords;
}
sbyte[] resultBytes = new sbyte[totalBytes];
int resultOffset = 0;
// Error-correct and copy data blocks together into a stream of bytes
for (int j = 0; j < dataBlocks.Length; j++)
{
DataBlock dataBlock = dataBlocks[j];
sbyte[] codewordBytes = dataBlock.Codewords;
int numDataCodewords = dataBlock.NumDataCodewords;
correctErrors(codewordBytes, numDataCodewords);
for (int i = 0; i < numDataCodewords; i++)
{
resultBytes[resultOffset++] = codewordBytes[i];
}
}
// Decode the contents of that stream of bytes
return DecodedBitStreamParser.decode(resultBytes, version, ecLevel);
}
开发者ID:slodge,项目名称:Blooor,代码行数:46,代码来源:Decoder.cs
示例18: sampleGrid
private static BitMatrix sampleGrid(BitMatrix matrix, ResultPoint topLeft, ResultPoint bottomLeft, ResultPoint topRight, ResultPoint bottomRight, int dimension)
{
// Note that unlike the QR Code sampler, we didn't find the center of modules, but the
// very corners. So there is no 0.5f here; 0.0f is right.
GridSampler sampler = GridSampler.Instance;
return sampler.sampleGrid(matrix, dimension, 0.0f, 0.0f, dimension, 0.0f, dimension, dimension, 0.0f, dimension, topLeft.X, topLeft.Y, topRight.X, topRight.Y, bottomRight.X, bottomRight.Y, bottomLeft.X, bottomLeft.Y); // p4FromY
}
开发者ID:mohamedibrahimabdoun,项目名称:AndroidApps,代码行数:9,代码来源:Detector.cs
示例19: extractPureBits
/// <summary> This method detects a barcode in a "pure" image -- that is, pure monochrome image
/// which contains only an unrotated, unskewed, image of a barcode, with some white border
/// around it. This is a specialized method that works exceptionally fast in this special
/// case.
/// </summary>
private static BitMatrix extractPureBits(BinaryBitmap image)
{
// Now need to determine module size in pixels
BitMatrix matrix = image.BlackMatrix;
int height = matrix.Height;
int width = matrix.Width;
int minDimension = System.Math.Min(height, width);
// First, skip white border by tracking diagonally from the top left down and to the right:
int borderWidth = 0;
while (borderWidth < minDimension && !matrix.get_Renamed(borderWidth, borderWidth))
{
borderWidth++;
}
if (borderWidth == minDimension)
{
throw ReaderException.Instance;
}
// And then keep tracking across the top-left black module to determine module size
int moduleEnd = borderWidth;
while (moduleEnd < minDimension && matrix.get_Renamed(moduleEnd, moduleEnd))
{
moduleEnd++;
}
if (moduleEnd == minDimension)
{
throw ReaderException.Instance;
}
int moduleSize = moduleEnd - borderWidth;
// And now find where the rightmost black module on the first row ends
int rowEndOfSymbol = width - 1;
while (rowEndOfSymbol >= 0 && !matrix.get_Renamed(rowEndOfSymbol, borderWidth))
{
rowEndOfSymbol--;
}
if (rowEndOfSymbol < 0)
{
throw ReaderException.Instance;
}
rowEndOfSymbol++;
// Make sure width of barcode is a multiple of module size
if ((rowEndOfSymbol - borderWidth) % moduleSize != 0)
{
throw ReaderException.Instance;
}
int dimension = (rowEndOfSymbol - borderWidth) / moduleSize;
// Push in the "border" by half the module width so that we start
// sampling in the middle of the module. Just in case the image is a
// little off, this will help recover.
borderWidth += (moduleSize >> 1);
int sampleDimension = borderWidth + (dimension - 1) * moduleSize;
if (sampleDimension >= width || sampleDimension >= height)
{
throw ReaderException.Instance;
}
// Now just read off the bits
BitMatrix bits = new BitMatrix(dimension);
for (int y = 0; y < dimension; y++)
{
int iOffset = borderWidth + y * moduleSize;
for (int x = 0; x < dimension; x++)
{
if (matrix.get_Renamed(borderWidth + x * moduleSize, iOffset))
{
bits.set_Renamed(x, y);
}
}
}
return bits;
}
开发者ID:hheeralal,项目名称:LoyalAZ-Mobile,代码行数:82,代码来源:PDF417Reader.cs
示例20: FinderPatternFinder
/// <summary> <p>Creates a finder that will search the image for three finder patterns.</p>
///
/// </summary>
/// <param name="image">image to search
/// </param>
public FinderPatternFinder(BitMatrix image):this(image, null)
{
}
开发者ID:jaychouzhou,项目名称:Ydifisofidosfj,代码行数:8,代码来源:FinderPatternFinder.cs
注:本文中的com.google.zxing.common.BitMatrix类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论