• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# common.BitArray类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中com.google.zxing.common.BitArray的典型用法代码示例。如果您正苦于以下问题:C# com.google.zxing.common.BitArray类的具体用法?C# com.google.zxing.common.BitArray怎么用?C# com.google.zxing.common.BitArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



com.google.zxing.common.BitArray类属于命名空间,在下文中一共展示了com.google.zxing.common.BitArray类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: decodeMiddle

		protected internal override int decodeMiddle(BitArray row, int[] startRange, System.Text.StringBuilder result)
		{
			int[] counters = decodeMiddleCounters;
			counters[0] = 0;
			counters[1] = 0;
			counters[2] = 0;
			counters[3] = 0;
			int end = row.Size;
			int rowOffset = startRange[1];
			
			int lgPatternFound = 0;
			
			for (int x = 0; x < 6 && rowOffset < end; x++)
			{
				int bestMatch = decodeDigit(row, counters, rowOffset, L_AND_G_PATTERNS);
				result.Append((char) ('0' + bestMatch % 10));
				for (int i = 0; i < counters.Length; i++)
				{
					rowOffset += counters[i];
				}
				if (bestMatch >= 10)
				{
					lgPatternFound |= 1 << (5 - x);
				}
			}
			
			determineNumSysAndCheckDigit(result, lgPatternFound);
			
			return rowOffset;
		}
开发者ID:cryophobia,项目名称:ZxingSharp.Mobile,代码行数:30,代码来源:UPCEReader.cs


示例2: decodeMiddle

		protected internal override int decodeMiddle(BitArray row, int[] startRange, System.Text.StringBuilder result)
		{
			int[] counters = decodeMiddleCounters;
			counters[0] = 0;
			counters[1] = 0;
			counters[2] = 0;
			counters[3] = 0;
			int end = row.Size;
			int rowOffset = startRange[1];
			
			for (int x = 0; x < 4 && rowOffset < end; x++)
			{
				int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS);
				result.Append((char) ('0' + bestMatch));
				for (int i = 0; i < counters.Length; i++)
				{
					rowOffset += counters[i];
				}
			}
			
			int[] middleRange = findGuardPattern(row, rowOffset, true, MIDDLE_PATTERN);
			rowOffset = middleRange[1];
			
			for (int x = 0; x < 4 && rowOffset < end; x++)
			{
				int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS);
				result.Append((char) ('0' + bestMatch));
				for (int i = 0; i < counters.Length; i++)
				{
					rowOffset += counters[i];
				}
			}
			
			return rowOffset;
		}
开发者ID:hheeralal,项目名称:LoyalAZ-Mobile,代码行数:35,代码来源:EAN8Reader.cs


示例3: buildMatrix

 // Build 2D matrix of QR Code from "dataBits" with "ecLevel", "version" and "getMaskPattern". On
 // success, store the result in "matrix" and return true.
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: static void buildMatrix(com.google.zxing.common.BitArray dataBits, com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ecLevel, com.google.zxing.qrcode.decoder.Version version, int maskPattern, ByteMatrix matrix) throws com.google.zxing.WriterException
 internal static void buildMatrix(BitArray dataBits, ErrorCorrectionLevel ecLevel, Version version, int maskPattern, ByteMatrix matrix)
 {
     clearMatrix(matrix);
     embedBasicPatterns(version, matrix);
     // Type information appear with any version.
     embedTypeInfo(ecLevel, maskPattern, matrix);
     // Version info appear if version >= 7.
     maybeEmbedVersionInfo(version, matrix);
     // Data should be embedded at end.
     embedDataBits(dataBits, maskPattern, matrix);
 }
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:15,代码来源:MatrixUtil.cs


示例4: decodeRow

		public override Result decodeRow(int rowNumber, BitArray row, System.Collections.Hashtable hints)
		{
			int size = readers.Count;
			for (int i = 0; i < size; i++)
			{
				OneDReader reader = (OneDReader) readers[i];
				try
				{
					return reader.decodeRow(rowNumber, row, hints);
				}
				catch (ReaderException re)
				{
					// continue
				}
			}
			
			throw ReaderException.Instance;
		}
开发者ID:jaychouzhou,项目名称:Ydifisofidosfj,代码行数:18,代码来源:MultiFormatOneDReader.cs


示例5: decodeRow

		public override Result decodeRow(int rowNumber, BitArray row, System.Collections.Hashtable hints)
		{
			
			// Find out where the Middle section (payload) starts & ends
			int[] startRange = decodeStart(row);
			int[] endRange = decodeEnd(row);
			
			System.Text.StringBuilder result = new System.Text.StringBuilder(20);
			decodeMiddle(row, startRange[1], endRange[0], result);
			System.String resultString = result.ToString();
			
			int[] allowedLengths = null;
			if (hints != null)
			{
				allowedLengths = (int[]) hints[DecodeHintType.ALLOWED_LENGTHS];
			}
			if (allowedLengths == null)
			{
				allowedLengths = DEFAULT_ALLOWED_LENGTHS;
			}
			
			// To avoid false positives with 2D barcodes (and other patterns), make
			// an assumption that the decoded string must be 6, 10 or 14 digits.
			int length = resultString.Length;
			bool lengthOK = false;
			for (int i = 0; i < allowedLengths.Length; i++)
			{
				if (length == allowedLengths[i])
				{
					lengthOK = true;
					break;
				}
			}
			if (!lengthOK)
			{
				throw ReaderException.Instance;
			}
			
			//UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
			return new Result(resultString, null, new ResultPoint[]{new ResultPoint(startRange[1], (float) rowNumber), new ResultPoint(endRange[0], (float) rowNumber)}, BarcodeFormat.ITF);
		}
开发者ID:hheeralal,项目名称:LoyalAZ-Mobile,代码行数:41,代码来源:ITFReader.cs


示例6: findStartGuardPattern

		internal static int[] findStartGuardPattern(BitArray row)
		{
			bool foundStart = false;
			int[] startRange = null;
			int nextStart = 0;
			while (!foundStart)
			{
				startRange = findGuardPattern(row, nextStart, false, START_END_PATTERN);
				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:hheeralal,项目名称:LoyalAZ-Mobile,代码行数:21,代码来源:UPCEANReader.cs


示例7: decodeRow

		public override Result decodeRow(int rowNumber, BitArray row, System.Collections.Hashtable hints)
		{
			// Compute this location once and reuse it on multiple implementations
			int[] startGuardPattern = UPCEANReader.findStartGuardPattern(row);
			int size = readers.Count;
			for (int i = 0; i < size; i++)
			{
				UPCEANReader reader = (UPCEANReader) readers[i];
				Result result;
				try
				{
					result = reader.decodeRow(rowNumber, row, startGuardPattern, hints);
				}
				catch (ReaderException re)
				{
					continue;
				}
				// Special case: a 12-digit code encoded in UPC-A is identical to a "0"
				// followed by those 12 digits encoded as EAN-13. Each will recognize such a code,
				// UPC-A as a 12-digit string and EAN-13 as a 13-digit string starting with "0".
				// Individually these are correct and their readers will both read such a code
				// and correctly call it EAN-13, or UPC-A, respectively.
				//
				// In this case, if we've been looking for both types, we'd like to call it
				// a UPC-A code. But for efficiency we only run the EAN-13 decoder to also read
				// UPC-A. So we special case it here, and convert an EAN-13 result to a UPC-A
				// result if appropriate.
				if (result.BarcodeFormat.Equals(BarcodeFormat.EAN_13) && result.Text[0] == '0')
				{
					return new Result(result.Text.Substring(1), null, result.ResultPoints, BarcodeFormat.UPC_A);
				}
				return result;
			}
			
			throw ReaderException.Instance;
		}
开发者ID:jaychouzhou,项目名称:Ydifisofidosfj,代码行数:36,代码来源:MultiFormatUPCEANReader.cs


示例8: decodeEnd

        /// <summary> Identify where the end of the middle / payload section ends.
        /// 
        /// </summary>
        /// <param name="row">row of black/white values to search
        /// </param>
        /// <returns> Array, containing index of start of 'end block' and end of 'end
        /// block'
        /// </returns>
        /// <throws>  ReaderException </throws>
        internal int[] decodeEnd(BitArray row)
        {
            // For convenience, reverse the row and then
            // search from 'the start' for the end block
            row.reverse();
            try
            {
                int endStart = skipWhiteSpace(row);
                int[] endPattern = findGuardPattern(row, endStart, END_PATTERN_REVERSED);

                // The start & end patterns must be pre/post fixed by a quiet zone. This
                // zone must be at least 10 times the width of a narrow line.
                // ref: http://www.barcode-1.net/i25code.html
                validateQuietZone(row, endPattern[0]);

                // Now recalculate the indices of where the 'endblock' starts & stops to
                // accommodate
                // the reversed nature of the search
                int temp = endPattern[0];
                endPattern[0] = row.Size - endPattern[1];
                endPattern[1] = row.Size - temp;

                return endPattern;
            }
            finally
            {
                // Put the row back the right way.
                row.reverse();
            }
        }
开发者ID:fsalinasna,项目名称:MyInventory,代码行数:39,代码来源:ITFReader.cs


示例9: decodeStart

        /// <summary> Identify where the start of the middle / payload section starts.
        /// 
        /// </summary>
        /// <param name="row">row of black/white values to search
        /// </param>
        /// <returns> Array, containing index of start of 'start block' and end of
        /// 'start block'
        /// </returns>
        /// <throws>  ReaderException </throws>
        internal int[] decodeStart(BitArray row)
        {
            int endStart = skipWhiteSpace(row);
            int[] startPattern = findGuardPattern(row, endStart, START_PATTERN);

            // Determine the width of a narrow line in pixels. We can do this by
            // getting the width of the start pattern and dividing by 4 because its
            // made up of 4 narrow lines.
            this.narrowLineWidth = (startPattern[1] - startPattern[0]) >> 2;

            validateQuietZone(row, startPattern[0]);

            return startPattern;
        }
开发者ID:fsalinasna,项目名称:MyInventory,代码行数:23,代码来源:ITFReader.cs


示例10: recordPattern

		/// <summary> Records the size of successive runs of white and black pixels in a row, starting at a given point.
		/// The values are recorded in the given array, and the number of runs recorded is equal to the size
		/// of the array. If the row starts on a white pixel at the given start point, then the first count
		/// recorded is the run of white pixels starting from that point; likewise it is the count of a run
		/// of black pixels if the row begin on a black pixels at that point.
		/// 
		/// </summary>
		/// <param name="row">row to count from
		/// </param>
		/// <param name="start">offset into row to start at
		/// </param>
		/// <param name="counters">array into which to record counts
		/// </param>
		/// <throws>  ReaderException if counters cannot be filled entirely from row before running out </throws>
		/// <summary>  of pixels
		/// </summary>
		internal static void  recordPattern(BitArray row, int start, int[] counters)
		{
			int numCounters = counters.Length;
			for (int i = 0; i < numCounters; i++)
			{
				counters[i] = 0;
			}
			int end = row.Size;
			if (start >= end)
			{
				throw ReaderException.Instance;
			}
			bool isWhite = !row.get_Renamed(start);
			int counterPosition = 0;
			int i2 = start;
			while (i2 < end)
			{
				bool pixel = row.get_Renamed(i2);
				if (pixel ^ isWhite)
				{
					// that is, exactly one is true
					counters[counterPosition]++;
				}
				else
				{
					counterPosition++;
					if (counterPosition == numCounters)
					{
						break;
					}
					else
					{
						counters[counterPosition] = 1;
						isWhite ^= true; // isWhite = !isWhite;
					}
				}
				i2++;
			}
			// If we read fully the last section of pixels and filled up our counters -- or filled
			// the last counter but ran off the side of the image, OK. Otherwise, a problem.
			if (!(counterPosition == numCounters || (counterPosition == numCounters - 1 && i2 == end)))
			{
				throw ReaderException.Instance;
			}
		}
开发者ID:noikiy,项目名称:Webcam.Net-QR-Decoder,代码行数:61,代码来源:OneDReader.cs


示例11: getBlackRow

 /// <summary> Converts one row of luminance data to 1 bit data. May actually do the conversion, or return
 /// cached data. Callers should assume this method is expensive and call it as seldom as possible.
 /// This method is intended for decoding 1D barcodes and may choose to apply sharpening.
 /// 
 /// </summary>
 /// <param name="y">The row to fetch, 0 <= y < bitmap height.
 /// </param>
 /// <param name="row">An optional preallocated array. If null or too small, it will be ignored.
 /// If used, the Binarizer will call BitArray.clear(). Always use the returned object.
 /// </param>
 /// <returns> The array of bits for this row (true means black).
 /// </returns>
 public BitArray getBlackRow(int y, BitArray row)
 {
     return binarizer.getBlackRow(y, row);
 }
开发者ID:tomcat1234,项目名称:WebQRReader,代码行数:16,代码来源:BinaryBitmap.cs


示例12: decodeEnd

 protected internal override int[] decodeEnd(BitArray row, int endStart)
 {
     return findGuardPattern(row, endStart, true, MIDDLE_END_PATTERN);
 }
开发者ID:fsalinasna,项目名称:MyInventory,代码行数:4,代码来源:UPCEReader.cs


示例13: decodeRow

 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: public com.google.zxing.Result decodeRow(int rowNumber, com.google.zxing.common.BitArray row, java.util.Map<com.google.zxing.DecodeHintType,?> hints) throws com.google.zxing.NotFoundException, com.google.zxing.FormatException, com.google.zxing.ChecksumException
 public override Result decodeRow(int rowNumber, BitArray row, IDictionary<DecodeHintType, object> hints)
 {
     return maybeReturnResult(ean13Reader.decodeRow(rowNumber, row, hints));
 }
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:6,代码来源:UPCAReader.cs


示例14: decodeCode

 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: private static int decodeCode(com.google.zxing.common.BitArray row, int[] counters, int rowOffset) throws com.google.zxing.NotFoundException
 private static int decodeCode(BitArray row, int[] counters, int rowOffset)
 {
     recordPattern(row, rowOffset, counters);
     int bestVariance = MAX_AVG_VARIANCE; // worst variance we'll accept
     int bestMatch = -1;
     for (int d = 0; d < CODE_PATTERNS.Length; d++)
     {
       int[] pattern = CODE_PATTERNS[d];
       int variance = patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE);
       if (variance < bestVariance)
       {
     bestVariance = variance;
     bestMatch = d;
       }
     }
     // TODO We're overlooking the fact that the STOP pattern has 7 values, not 6.
     if (bestMatch >= 0)
     {
       return bestMatch;
     }
     else
     {
       throw NotFoundException.NotFoundInstance;
     }
 }
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:27,代码来源:Code128Reader.cs


示例15: skipWhiteSpace

        /// <summary> Skip all whitespace until we get to the first black line.
        /// 
        /// </summary>
        /// <param name="row">row of black/white values to search
        /// </param>
        /// <returns> index of the first black line.
        /// </returns>
        /// <throws>  ReaderException Throws exception if no black lines are found in the row </throws>
        private static int skipWhiteSpace(BitArray row)
        {
            int width = row.Size;
            int endStart = 0;
            while (endStart < width)
            {
                if (row.get_Renamed(endStart))
                {
                    break;
                }
                endStart++;
            }
            if (endStart == width)
            {
                throw ReaderException.Instance;
            }

            return endStart;
        }
开发者ID:fsalinasna,项目名称:MyInventory,代码行数:27,代码来源:ITFReader.cs


示例16: decodeRow

		public override Result decodeRow(int rowNumber, BitArray row, System.Collections.Hashtable hints)
		{
			return maybeReturnResult(ean13Reader.decodeRow(rowNumber, row, hints));
		}
开发者ID:hheeralal,项目名称:LoyalAZ-Mobile,代码行数:4,代码来源:UPCAReader.cs


示例17: decodeMiddle

		protected internal override int decodeMiddle(BitArray row, int[] startRange, System.Text.StringBuilder resultString)
		{
			return ean13Reader.decodeMiddle(row, startRange, resultString);
		}
开发者ID:hheeralal,项目名称:LoyalAZ-Mobile,代码行数:4,代码来源:UPCAReader.cs


示例18: decodeRow

 // added by .net follower (http://dotnetfollower.com)
 // public override Result decodeRow(int rowNumber, BitArray row, System.Collections.Hashtable hints) // commented by .net follower (http://dotnetfollower.com)
 public override Result decodeRow(int rowNumber, BitArray row, System.Collections.Generic.Dictionary<Object, Object> hints)
 {
     return maybeReturnResult(ean13Reader.decodeRow(rowNumber, row, hints));
 }
开发者ID:rondvorak,项目名称:jade_change,代码行数:6,代码来源:UPCAReader.cs


示例19: decodeRow

        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public com.google.zxing.Result decodeRow(int rowNumber, com.google.zxing.common.BitArray row, java.util.Map<com.google.zxing.DecodeHintType,?> hints) throws com.google.zxing.NotFoundException
        public override Result decodeRow(int rowNumber, BitArray row, IDictionary<DecodeHintType, object> hints)
        {
            // Compute this location once and reuse it on multiple implementations
            int[] startGuardPattern = UPCEANReader.findStartGuardPattern(row);
            foreach (UPCEANReader reader in readers)
            {
              Result result;
              try
              {
            result = reader.decodeRow(rowNumber, row, startGuardPattern, hints);
              }
              catch (ReaderException re)
              {
            continue;
              }
              // Special case: a 12-digit code encoded in UPC-A is identical to a "0"
              // followed by those 12 digits encoded as EAN-13. Each will recognize such a code,
              // UPC-A as a 12-digit string and EAN-13 as a 13-digit string starting with "0".
              // Individually these are correct and their readers will both read such a code
              // and correctly call it EAN-13, or UPC-A, respectively.
              //
              // In this case, if we've been looking for both types, we'd like to call it
              // a UPC-A code. But for efficiency we only run the EAN-13 decoder to also read
              // UPC-A. So we special case it here, and convert an EAN-13 result to a UPC-A
              // result if appropriate.
              //
              // But, don't return UPC-A if UPC-A was not a requested format!
              bool ean13MayBeUPCA = result.BarcodeFormat == BarcodeFormat.EAN_13 && result.Text[0] == '0';
              //ICollection<BarcodeFormat> possibleFormats = hints == null ? null : (ICollection<BarcodeFormat>) hints[DecodeHintType.POSSIBLE_FORMATS];
              ICollection<BarcodeFormat> possibleFormats = null;
              if (hints != null && hints.ContainsKey(DecodeHintType.POSSIBLE_FORMATS))
              {
              possibleFormats = (ICollection<BarcodeFormat>)hints[DecodeHintType.POSSIBLE_FORMATS];
              }

              bool canReturnUPCA = possibleFormats == null || possibleFormats.Contains(BarcodeFormat.UPC_A);

              if (ean13MayBeUPCA && canReturnUPCA)
              {
            // Transfer the metdata across
            Result resultUPCA = new Result(result.Text.Substring(1), result.RawBytes, result.ResultPoints, BarcodeFormat.UPC_A);
            resultUPCA.putAllMetadata(result.ResultMetadata);
            return resultUPCA;
              }
              return result;
            }

            throw NotFoundException.NotFoundInstance;
        }
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:51,代码来源:MultiFormatUPCEANReader.cs


示例20: getBlackRow

 /// <summary>
 /// Converts one row of luminance data to 1 bit data. May actually do the conversion, or return
 /// cached data. Callers should assume this method is expensive and call it as seldom as possible.
 /// This method is intended for decoding 1D barcodes and may choose to apply sharpening.
 /// For callers which only examine one row of pixels at a time, the same BitArray should be reused
 /// and passed in with each call for performance. However it is legal to keep more than one row
 /// at a time if needed.
 /// </summary>
 /// <param name="y"> The row to fetch, 0 <= y < bitmap height. </param>
 /// <param name="row"> An optional preallocated array. If null or too small, it will be ignored.
 ///            If used, the Binarizer will call BitArray.clear(). Always use the returned object. </param>
 /// <returns> The array of bits for this row (true means black). </returns>
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: public abstract com.google.zxing.common.BitArray getBlackRow(int y, com.google.zxing.common.BitArray row) throws NotFoundException;
 public abstract BitArray getBlackRow(int y, BitArray row);
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:15,代码来源:Binarizer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# common.BitMatrix类代码示例发布时间:2022-05-24
下一篇:
C# com类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap