本文整理汇总了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类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}