当前位置: 首页>>代码示例>>C#>>正文


C# BinaryBitmap.crop方法代码示例

本文整理汇总了C#中BinaryBitmap.crop方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryBitmap.crop方法的具体用法?C# BinaryBitmap.crop怎么用?C# BinaryBitmap.crop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BinaryBitmap的用法示例。


在下文中一共展示了BinaryBitmap.crop方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: decode

      public Result decode(BinaryBitmap image, IDictionary<DecodeHintType, object> hints)
      {
         int width = image.Width;
         int height = image.Height;
         int halfWidth = width/2;
         int halfHeight = height/2;

         var topLeft = image.crop(0, 0, halfWidth, halfHeight);
         var result = @delegate.decode(topLeft, hints);
         if (result != null)
            return result;

         var topRight = image.crop(halfWidth, 0, halfWidth, halfHeight);
         result = @delegate.decode(topRight, hints);
         if (result != null)
            return result;

         var bottomLeft = image.crop(0, halfHeight, halfWidth, halfHeight);
         result = @delegate.decode(bottomLeft, hints);
         if (result != null)
            return result;

         var bottomRight = image.crop(halfWidth, halfHeight, halfWidth, halfHeight);
         result = @delegate.decode(bottomRight, hints);
         if (result != null)
            return result;

         int quarterWidth = halfWidth/2;
         int quarterHeight = halfHeight/2;
         var center = image.crop(quarterWidth, quarterHeight, halfWidth, halfHeight);
         return @delegate.decode(center, hints);
      }
开发者ID:Bogdan-p,项目名称:ZXing.Net,代码行数:32,代码来源:ByQuadrantReader.cs

示例2: decode

        public Result decode(BinaryBitmap image, Dictionary<DecodeHintType, Object> hints)
        {
            int width = image.Width;
            int height = image.Height;
            int halfWidth = width/2;
            int halfHeight = height/2;

            BinaryBitmap topLeft = image.crop(0, 0, halfWidth, halfHeight);
            try
            {
                return delegate_Renamed.decode(topLeft, hints);
            }
            catch (ReaderException)
            {
                // continue
            }

            BinaryBitmap topRight = image.crop(halfWidth, 0, halfWidth, halfHeight);
            try
            {
                return delegate_Renamed.decode(topRight, hints);
            }
            catch (ReaderException)
            {
                // continue
            }

            BinaryBitmap bottomLeft = image.crop(0, halfHeight, halfWidth, halfHeight);
            try
            {
                return delegate_Renamed.decode(bottomLeft, hints);
            }
            catch (ReaderException)
            {
                // continue
            }

            BinaryBitmap bottomRight = image.crop(halfWidth, halfHeight, halfWidth, halfHeight);
            try
            {
                return delegate_Renamed.decode(bottomRight, hints);
            }
            catch (ReaderException)
            {
                // continue
            }

            int quarterWidth = halfWidth/2;
            int quarterHeight = halfHeight/2;
            BinaryBitmap center = image.crop(quarterWidth, quarterHeight, halfWidth, halfHeight);
            return delegate_Renamed.decode(center, hints);
        }
开发者ID:henningms,项目名称:zxing2.0-wp7,代码行数:52,代码来源:ByQuadrantReader.cs

示例3: decode

      /// <summary>
      /// Locates and decodes a barcode in some format within an image. This method also accepts
      /// hints, each possibly associated to some data, which may help the implementation decode.
      /// </summary>
      /// <param name="image">image of barcode to decode</param>
      /// <param name="hints">passed as a <see cref="IDictionary{TKey, TValue}"/> from <see cref="DecodeHintType"/>
      /// to arbitrary data. The
      /// meaning of the data depends upon the hint type. The implementation may or may not do
      /// anything with these hints.</param>
      /// <returns>
      /// String which the barcode encodes
      /// </returns>
      public Result decode(BinaryBitmap image, IDictionary<DecodeHintType, object> hints)
      {
         int width = image.Width;
         int height = image.Height;
         int halfWidth = width/2;
         int halfHeight = height/2;

         // No need to call makeAbsolute as results will be relative to original top left here
         var result = @delegate.decode(image.crop(0, 0, halfWidth, halfHeight), hints);
         if (result != null)
            return result;

         result = @delegate.decode(image.crop(halfWidth, 0, halfWidth, halfHeight), hints);
         if (result != null)
         {
            makeAbsolute(result.ResultPoints, halfWidth, 0);
            return result;
         }

         result = @delegate.decode(image.crop(0, halfHeight, halfWidth, halfHeight), hints);
         if (result != null)
         {
            makeAbsolute(result.ResultPoints, 0, halfHeight);
            return result;
         }

         result = @delegate.decode(image.crop(halfWidth, halfHeight, halfWidth, halfHeight), hints);
         if (result != null)
         {
            makeAbsolute(result.ResultPoints, halfWidth, halfHeight);
            return result;
         }

         int quarterWidth = halfWidth/2;
         int quarterHeight = halfHeight/2;
         var center = image.crop(quarterWidth, quarterHeight, halfWidth, halfHeight);
         result = @delegate.decode(center, hints);
         makeAbsolute(result.ResultPoints, quarterWidth, quarterHeight);
         return result;
      }
开发者ID:Binjaaa,项目名称:ZXing.Net.Mobile,代码行数:52,代码来源:ByQuadrantReader.cs

示例4: doDecodeMultiple

      private void doDecodeMultiple(BinaryBitmap image, IDictionary<DecodeHintType, object> hints, IList<Result> results, int xOffset, int yOffset, int currentDepth)
      {
         if (currentDepth > MAX_DEPTH)
         {
            return;
         }

         Result result = _delegate.decode(image, hints);
         if (result == null)
            return;

         bool alreadyFound = false;
         for (int i = 0; i < results.Count; i++)
         {
            Result existingResult = (Result)results[i];
            if (existingResult.Text.Equals(result.Text))
            {
               alreadyFound = true;
               break;
            }
         }
         if (!alreadyFound)
         {
            results.Add(translateResultPoints(result, xOffset, yOffset));
         }

         ResultPoint[] resultPoints = result.ResultPoints;
         if (resultPoints == null || resultPoints.Length == 0)
         {
            return;
         }
         int width = image.Width;
         int height = image.Height;
         float minX = width;
         float minY = height;
         float maxX = 0.0f;
         float maxY = 0.0f;
         for (int i = 0; i < resultPoints.Length; i++)
         {
            ResultPoint point = resultPoints[i];
            float x = point.X;
            float y = point.Y;
            if (x < minX)
            {
               minX = x;
            }
            if (y < minY)
            {
               minY = y;
            }
            if (x > maxX)
            {
               maxX = x;
            }
            if (y > maxY)
            {
               maxY = y;
            }
         }

         // Decode left of barcode
         if (minX > MIN_DIMENSION_TO_RECUR)
         {
            doDecodeMultiple(image.crop(0, 0, (int)minX, height), hints, results, xOffset, yOffset, currentDepth + 1);
         }
         // Decode above barcode
         if (minY > MIN_DIMENSION_TO_RECUR)
         {
            doDecodeMultiple(image.crop(0, 0, width, (int)minY), hints, results, xOffset, yOffset, currentDepth + 1);
         }
         // Decode right of barcode
         if (maxX < width - MIN_DIMENSION_TO_RECUR)
         {
            doDecodeMultiple(image.crop((int)maxX, 0, width - (int)maxX, height), hints, results, xOffset + (int)maxX, yOffset, currentDepth + 1);
         }
         // Decode below barcode
         if (maxY < height - MIN_DIMENSION_TO_RECUR)
         {
            doDecodeMultiple(image.crop(0, (int)maxY, width, height - (int)maxY), hints, results, xOffset, yOffset + (int)maxY, currentDepth + 1);
         }
      }
开发者ID:rfosterfrss,项目名称:ZXing.Net.Mobile,代码行数:81,代码来源:GenericMultipleBarcodeReader.cs

示例5: doDecodeMultiple

      private void doDecodeMultiple(BinaryBitmap image, IDictionary<DecodeHintType, object> hints, IList<Result> results, int xOffset, int yOffset)
      {
         Result result = _delegate.decode(image, hints);
         if (result == null)
            return;

         bool alreadyFound = false;
         for (int i = 0; i < results.Count; i++)
         {
            Result existingResult = (Result)results[i];
            if (existingResult.Text.Equals(result.Text))
            {
               alreadyFound = true;
               break;
            }
         }
         if (alreadyFound)
         {
            return;
         }
         results.Add(translateResultPoints(result, xOffset, yOffset));
         ResultPoint[] resultPoints = result.ResultPoints;
         if (resultPoints == null || resultPoints.Length == 0)
         {
            return;
         }
         int width = image.Width;
         int height = image.Height;
         float minX = width;
         float minY = height;
         float maxX = 0.0f;
         float maxY = 0.0f;
         for (int i = 0; i < resultPoints.Length; i++)
         {
            ResultPoint point = resultPoints[i];
            float x = point.X;
            float y = point.Y;
            if (x < minX)
            {
               minX = x;
            }
            if (y < minY)
            {
               minY = y;
            }
            if (x > maxX)
            {
               maxX = x;
            }
            if (y > maxY)
            {
               maxY = y;
            }
         }

         // Decode left of barcode
         if (minX > MIN_DIMENSION_TO_RECUR)
         {
            //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'"
            doDecodeMultiple(image.crop(0, 0, (int)minX, height), hints, results, xOffset, yOffset);
         }
         // Decode above barcode
         if (minY > MIN_DIMENSION_TO_RECUR)
         {
            //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'"
            doDecodeMultiple(image.crop(0, 0, width, (int)minY), hints, results, xOffset, yOffset);
         }
         // Decode right of barcode
         if (maxX < width - MIN_DIMENSION_TO_RECUR)
         {
            //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'"
            doDecodeMultiple(image.crop((int)maxX, 0, width - (int)maxX, height), hints, results, xOffset + (int)maxX, yOffset);
         }
         // Decode below barcode
         if (maxY < height - MIN_DIMENSION_TO_RECUR)
         {
            //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'"
            doDecodeMultiple(image.crop(0, (int)maxY, width, height - (int)maxY), hints, results, xOffset, yOffset + (int)maxY);
         }
      }
开发者ID:GSerjo,项目名称:Seminars,代码行数:80,代码来源:GenericMultipleBarcodeReader.cs


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