Пример #1
0
      /// <summary>
      /// Detects the multi.
      /// </summary>
      /// <param name="hints">The hints.</param>
      /// <returns></returns>
      public DetectorResult[] detectMulti(IDictionary<DecodeHintType, object> hints)
      {
         var image = Image;
         var resultPointCallback =
             hints == null || !hints.ContainsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK) ? null : (ResultPointCallback)hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK];
         var finder = new MultiFinderPatternFinder(image, resultPointCallback);
         var infos = finder.findMulti(hints);

         if (infos.Length == 0)
         {
            return EMPTY_DETECTOR_RESULTS;
         }

         var result = new List<DetectorResult>();
         foreach (FinderPatternInfo info in infos)
         {
            var oneResult = processFinderPatternInfo(info);
            if (oneResult != null)
               result.Add(oneResult);
         }
         if (result.Count == 0)
         {
            return EMPTY_DETECTOR_RESULTS;
         }
         else
         {
            return result.ToArray();
         }
      }
Пример #2
0
        public DetectorResult[] detectMulti(System.Collections.Hashtable hints)
        {
            BitMatrix image = Image;
            MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image);
            FinderPatternInfo[] info = finder.findMulti(hints);

            if (info == null || info.Length == 0)
            {
                throw ReaderException.Instance;
            }

            System.Collections.ArrayList result = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
            for (int i = 0; i < info.Length; i++)
            {
                try
                {
                    result.Add(processFinderPatternInfo(info[i]));
                }
                catch (ReaderException)
                {
                    // ignore
                }
            }
            if ((result.Count == 0))
            {
                return EMPTY_DETECTOR_RESULTS;
            }
            else
            {
                DetectorResult[] resultArray = new DetectorResult[result.Count];
                for (int i = 0; i < result.Count; i++)
                {
                    resultArray[i] = (DetectorResult) result[i];
                }
                return resultArray;
            }
        }