Пример #1
0
 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;
 }
Пример #2
0
 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;
 }
Пример #3
0
 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;
 }
Пример #4
0
 public FinderPatternFinder(BitMatrix image, ResultPointCallback resultPointCallback)
 {
     this.image                = image;
     this.possibleCenters      = new List <object>();
     this.crossCheckStateCount = new int[5];
     this.resultPointCallback  = resultPointCallback;
 }
Пример #5
0
 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;
 }
Пример #6
0
 public FinderPatternFinder(BitMatrix image, ResultPointCallback resultPointCallback)
 {
     this.image = image;
     // this.possibleCenters = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10)); // commented by .net follower (http://dotnetfollower.com)
     this.possibleCenters      = new System.Collections.Generic.List <Object>(10); // added by .net follower (http://dotnetfollower.com)
     this.crossCheckStateCount = new int[5];
     this.resultPointCallback  = resultPointCallback;
 }
Пример #7
0
        /// <summary> <p>Like {@link #decodeRow(int, BitArray, java.util.Hashtable)}, but
        /// allows caller to inform method about where the UPC/EAN start pattern is
        /// found. This allows this to be computed once and reused across many implementations.</p>
        /// </summary>
        public virtual Result decodeRow(int rowNumber, BitArray row, int[] startGuardRange, System.Collections.Hashtable hints)
        {
            ResultPointCallback resultPointCallback = hints == null?null:(ResultPointCallback)hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK];

            if (resultPointCallback != null)
            {
                resultPointCallback.foundPossibleResultPoint(new ResultPoint((startGuardRange[0] + startGuardRange[1]) / 2.0f, rowNumber));
            }

            System.Text.StringBuilder result = decodeRowStringBuffer;
            result.Length = 0;

            int?endStartNullable = decodeMiddle(row, startGuardRange, result);

            if (endStartNullable.IsBlank())
            {
                return(null);
            }

            int endStart = (int)endStartNullable;

            if (resultPointCallback != null)
            {
                resultPointCallback.foundPossibleResultPoint(new ResultPoint(endStart, rowNumber));
            }

            int[] endRange = decodeEnd(row, endStart);

            if (resultPointCallback != null)
            {
                resultPointCallback.foundPossibleResultPoint(new ResultPoint((endRange[0] + endRange[1]) / 2.0f, rowNumber));
            }


            // Make sure there is a quiet zone at least as big as the end pattern after the barcode. The
            // spec might want more whitespace, but in practice this is the maximum we can count on.
            int end      = endRange[1];
            int quietEnd = end + (end - endRange[0]);

            if (quietEnd >= row.Size() || !row.isRange(end, quietEnd, false))
            {
                return(null);
            }

            System.String resultString = result.ToString();
            if (!checkChecksum(resultString))
            {
                return(null);
            }

            //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'"
            float left = (float)(startGuardRange[1] + startGuardRange[0]) / 2.0f;
            //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'"
            float right = (float)(endRange[1] + endRange[0]) / 2.0f;

            //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(left, (float)rowNumber), new ResultPoint(right, (float)rowNumber) }, BarcodeFormat));
        }
Пример #8
0
        /// <summary> <p>Detects a QR Code in an image, simply.</p>
        ///
        /// </summary>
        /// <param name="hints">optional hints to detector
        /// </param>
        /// <returns> {@link DetectorResult} encapsulating results of detecting a QR Code
        /// </returns>
        /// <throws>  ReaderException if no QR Code can be found </throws>
        public virtual DetectorResult detect(System.Collections.Hashtable hints)
        {
            resultPointCallback = hints == null?null:(ResultPointCallback)hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK];

            FinderPatternFinder finder = new FinderPatternFinder(image, resultPointCallback);
            FinderPatternInfo   info   = finder.find(hints);

            return(processFinderPatternInfo(info));
        }
 /// <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;
 }
Пример #10
0
 /// <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 <object>();
     this.startX               = startX;
     this.startY               = startY;
     this.width                = width;
     this.height               = height;
     this.moduleSize           = moduleSize;
     this.crossCheckStateCount = new int[3];
     this.resultPointCallback  = resultPointCallback;
 }
 /// <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;
 }
		/// <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;
		}
Пример #13
0
        /// <summary> <p>Detects a QR Code in an image, simply.</p>
        ///
        /// </summary>
        /// <param name="hints">optional hints to detector
        /// </param>
        /// <returns> {@link DetectorResult} encapsulating results of detecting a QR Code
        /// </returns>
        /// <throws>  ReaderException if no QR Code can be found </throws>
        public virtual DetectorResult detect(System.Collections.Generic.Dictionary <Object, Object> hints)
        {
            resultPointCallback = hints == null?null: hints.ContainsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK)?(ResultPointCallback)hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK]:null;

            FinderPatternFinder finder = new FinderPatternFinder(image, resultPointCallback);
            FinderPatternInfo   info   = finder.find(hints);

            if (info == null)
            {
                return(null);
            }
            return(processFinderPatternInfo(info));
        }
Пример #14
0
        /// <summary> <p>Detects a QR Code in an image, simply.</p>
        ///
        /// </summary>
        /// <param name="hints">optional hints to detector
        /// </param>
        /// <returns> {@link DetectorResult} encapsulating results of detecting a QR Code
        /// </returns>
        /// <throws>  ReaderException if no QR Code can be found </throws>
        // public virtual DetectorResult detect(System.Collections.Hashtable hints) // commented by .net follower (http://dotnetfollower.com)
        public virtual DetectorResult detect(System.Collections.Generic.Dictionary <Object, Object> hints) // added by .net follower (http://dotnetfollower.com)
        {
            // resultPointCallback = hints == null?null:(ResultPointCallback) hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK]; // commented by .net follower (http://dotnetfollower.com)
            resultPointCallback = null;                                                                      // added by .net follower (http://dotnetfollower.com)
            if (hints != null && hints.ContainsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK))               // added by .net follower (http://dotnetfollower.com)
            {
                resultPointCallback = (ResultPointCallback)hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK]; // added by .net follower (http://dotnetfollower.com)
            }
            FinderPatternFinder finder = new FinderPatternFinder(image, resultPointCallback);
            FinderPatternInfo   info   = finder.find(hints);

            return(processFinderPatternInfo(info));
        }
Пример #15
0
 /// <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)); // commented by .net follower (http://dotnetfollower.com)
     this.possibleCenters      = new System.Collections.Generic.List <Object>(5); // added by .net follower (http://dotnetfollower.com)
     this.startX               = startX;
     this.startY               = startY;
     this.width                = width;
     this.height               = height;
     this.moduleSize           = moduleSize;
     this.crossCheckStateCount = new int[3];
     this.resultPointCallback  = resultPointCallback;
 }
Пример #16
0
        // added by .net follower (http://dotnetfollower.com)
        /// <summary> <p>Detects a QR Code in an image, simply.</p>
        /// 
        /// </summary>
        /// <param name="hints">optional hints to detector
        /// </param>
        /// <returns> {@link DetectorResult} encapsulating results of detecting a QR Code
        /// </returns>
        /// <throws>  ReaderException if no QR Code can be found </throws>
        // public virtual DetectorResult detect(System.Collections.Hashtable hints) // commented by .net follower (http://dotnetfollower.com)
        public virtual DetectorResult detect(System.Collections.Generic.Dictionary<Object, Object> hints)
        {
            // resultPointCallback = hints == null?null:(ResultPointCallback) hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK]; // commented by .net follower (http://dotnetfollower.com)
            resultPointCallback = null; // added by .net follower (http://dotnetfollower.com)
            if (hints != null && hints.ContainsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK)) // added by .net follower (http://dotnetfollower.com)
                resultPointCallback = (ResultPointCallback)hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK]; // added by .net follower (http://dotnetfollower.com)

            FinderPatternFinder finder = new FinderPatternFinder(image, resultPointCallback);
            FinderPatternInfo info = finder.find(hints);

            return processFinderPatternInfo(info);
        }
Пример #17
0
        /// <summary>
        /// <p>Detects a QR Code in an image, simply.</p>
        /// </summary>
        /// <param name="hints"> optional hints to detector </param>
        /// <returns> <seealso cref="NotFoundException"/> encapsulating results of detecting a QR Code </returns>
        /// <exception cref="NotFoundException"> if QR Code cannot be found </exception>
        /// <exception cref="FormatException"> if a QR Code cannot be decoded </exception>
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public final com.google.zxing.common.DetectorResult detect(java.util.Map<com.google.zxing.DecodeHintType,?> hints) throws com.google.zxing.NotFoundException, com.google.zxing.FormatException
        public DetectorResult detect(IDictionary<DecodeHintType, object> hints)
        {
            //resultPointCallback = hints == null ? null : (ResultPointCallback)hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK];
              ResultPointCallback resultPointCallback = null;
              if (hints != null && hints.ContainsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK))
              {
              resultPointCallback = (ResultPointCallback)hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK];
              }

            FinderPatternFinder finder = new FinderPatternFinder(image, resultPointCallback);
            FinderPatternInfo info = finder.find(hints);

            return processFinderPatternInfo(info);
        }
Пример #18
0
        /// <summary> <p>Detects a QR Code in an image, simply.</p>
        /// 
        /// </summary>
        /// <param name="hints">optional hints to detector
        /// </param>
        /// <returns> {@link DetectorResult} encapsulating results of detecting a QR Code
        /// </returns>
        /// <throws>  ReaderException if no QR Code can be found </throws>
        public virtual DetectorResult detect(System.Collections.Hashtable hints)
        {
            resultPointCallback = hints == null?null:(ResultPointCallback) hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK];

            FinderPatternFinder finder = new FinderPatternFinder(image, resultPointCallback);
            FinderPatternInfo info = finder.find(hints);

            return processFinderPatternInfo(info);
        }
Пример #19
0
 internal MultiFinderPatternFinder(BitMatrix image, ResultPointCallback resultPointCallback) : base(image, resultPointCallback)
 {
 }
Пример #20
0
 /// <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)
 //{
 //}
 public FinderPatternFinder(BitMatrix image, ResultPointCallback resultPointCallback)
 {
     this.image = image;
     this.possibleCenters = new ArrayList();
     this.crossCheckStateCount = new int[5];
     this.resultPointCallback = resultPointCallback;
 }
 internal MultiFinderPatternFinder(BitMatrix image, ResultPointCallback resultPointCallback)
     : base(image, resultPointCallback)
 {
 }
 /// <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)); // commented by .net follower (http://dotnetfollower.com)
     this.possibleCenters = new System.Collections.Generic.List<Object>(5); // added by .net follower (http://dotnetfollower.com)
     this.startX = startX;
     this.startY = startY;
     this.width = width;
     this.height = height;
     this.moduleSize = moduleSize;
     this.crossCheckStateCount = new int[3];
     this.resultPointCallback = resultPointCallback;
 }
Пример #23
0
        /// <summary> <p>Detects a QR Code in an image, simply.</p>
        /// 
        /// </summary>
        /// <param name="hints">optional hints to detector
        /// </param>
        /// <returns> {@link DetectorResult} encapsulating results of detecting a QR Code
        /// </returns>
        /// <throws>  ReaderException if no QR Code can be found </throws>
        public virtual DetectorResult detect(System.Collections.Generic.Dictionary<Object,Object> hints)
        {
            resultPointCallback = hints == null?null: hints.ContainsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK)?(ResultPointCallback) hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK]:null;

            FinderPatternFinder finder = new FinderPatternFinder(image, resultPointCallback);
            FinderPatternInfo info = finder.find(hints);

            return processFinderPatternInfo(info);
        }
 public FinderPatternFinder(BitMatrix image, ResultPointCallback resultPointCallback)
 {
     this.image = image;
     // this.possibleCenters = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10)); // commented by .net follower (http://dotnetfollower.com)
     this.possibleCenters = new System.Collections.Generic.List<Object>(10); // added by .net follower (http://dotnetfollower.com)
     this.crossCheckStateCount = new int[5];
     this.resultPointCallback = resultPointCallback;
 }