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


C# ResultPoint类代码示例

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


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

示例1: createTransform

        public virtual PerspectiveTransform createTransform(ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft, ResultPoint alignmentPattern, int dimension)
        {
            //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 dimMinusThree = (float) dimension - 3.5f;
            float bottomRightX;
            float bottomRightY;
            float sourceBottomRightX;
            float sourceBottomRightY;
            if (alignmentPattern != null)
            {
                bottomRightX = alignmentPattern.X;
                bottomRightY = alignmentPattern.Y;
                sourceBottomRightX = sourceBottomRightY = dimMinusThree - 3.0f;
            }
            else
            {
                // Don't have an alignment pattern, just make up the bottom-right point
                bottomRightX = (topRight.X - topLeft.X) + bottomLeft.X;
                bottomRightY = (topRight.Y - topLeft.Y) + bottomLeft.Y;
                sourceBottomRightX = sourceBottomRightY = dimMinusThree;
            }

            PerspectiveTransform transform = PerspectiveTransform.quadrilateralToQuadrilateral(3.5f, 3.5f, dimMinusThree, 3.5f, sourceBottomRightX, sourceBottomRightY, 3.5f, dimMinusThree, topLeft.X, topLeft.Y, topRight.X, topRight.Y, bottomRightX, bottomRightY, bottomLeft.X, bottomLeft.Y);

            return transform;
        }
开发者ID:hankhongyi,项目名称:zxing_for_wp8,代码行数:26,代码来源:Detector.cs

示例2: applyMirroredCorrection

 /// <summary>
 /// Apply the result points' order correction due to mirroring.
 /// </summary>
 /// <param name="points">Array of points to apply mirror correction to.</param>
 internal void applyMirroredCorrection(ResultPoint[] points)
 {
    if (!mirrored || points == null || points.Length < 3)
    {
       return;
    }
    ResultPoint bottomLeft = points[0];
    points[0] = points[2];
    points[2] = bottomLeft;
    // No need to 'fix' top-left and alignment pattern.
 }
开发者ID:n1rvana,项目名称:ZXing.NET,代码行数:15,代码来源:QRCodeDecoderMetaData.cs

示例3: AztecDetectorResult

 /// <summary>
 /// Initializes a new instance of the <see cref="AztecDetectorResult"/> class.
 /// </summary>
 /// <param name="bits">The bits.</param>
 /// <param name="points">The points.</param>
 /// <param name="compact">if set to <c>true</c> [compact].</param>
 /// <param name="nbDatablocks">The nb datablocks.</param>
 /// <param name="nbLayers">The nb layers.</param>
 public AztecDetectorResult(BitMatrix bits,
                            ResultPoint[] points,
                            bool compact,
                            int nbDatablocks,
                            int nbLayers)
    : base(bits, points)
 {
    Compact = compact;
    NbDatablocks = nbDatablocks;
    NbLayers = nbLayers;
 }
开发者ID:Redth,项目名称:ZXing.Net.Mobile,代码行数:19,代码来源:AztecDetectorResult.cs

示例4: Result

 public Result(String text, sbyte[] rawBytes, ResultPoint[] resultPoints, BarcodeFormat format)
 {
     if (text == null && rawBytes == null)
     {
         throw new ArgumentException("Text and bytes are null");
     }
     this.text = text;
     this.rawBytes = rawBytes;
     this.resultPoints = resultPoints;
     this.format = format;
     resultMetadata = null;
 }
开发者ID:henningms,项目名称:zxing2.0-wp7,代码行数:12,代码来源:Result.cs

示例5: Create

        /// <summary>
        /// Initializes a new instance of the <see cref="ZXing.PDF417.Internal.BoundingBox"/> class.
        /// returns null if the corner points don't match up correctly
        /// </summary>
        /// <param name="image">The image.</param>
        /// <param name="topLeft">The top left.</param>
        /// <param name="bottomLeft">The bottom left.</param>
        /// <param name="topRight">The top right.</param>
        /// <param name="bottomRight">The bottom right.</param>
        /// <returns></returns>
        public static BoundingBox Create(BitMatrix image,
                                         ResultPoint topLeft,
                                         ResultPoint bottomLeft,
                                         ResultPoint topRight,
                                         ResultPoint bottomRight)
        {
            if ((topLeft == null && topRight == null) ||
                (bottomLeft == null && bottomRight == null) ||
                (topLeft != null && bottomLeft == null) ||
                (topRight != null && bottomRight == null))
            {
                return null;
            }

            return new BoundingBox(image, topLeft, bottomLeft, topRight, bottomRight);
        }
开发者ID:hydrayu,项目名称:imobile-src,代码行数:26,代码来源:BoundingBox.cs

示例6: BoundingBox

        /// <summary>
        /// Initializes a new instance of the <see cref="ZXing.PDF417.Internal.BoundingBox"/> class.
        /// Will throw an exception if the corner points don't match up correctly
        /// </summary>
        /// <param name="image">Image.</param>
        /// <param name="topLeft">Top left.</param>
        /// <param name="topRight">Top right.</param>
        /// <param name="bottomLeft">Bottom left.</param>
        /// <param name="bottomRight">Bottom right.</param>
        public BoundingBox(BitMatrix image, 
                           ResultPoint topLeft, 
                           ResultPoint bottomLeft,
                           ResultPoint topRight, 
                           ResultPoint bottomRight)
        {
            if ((topLeft == null && topRight == null) ||
                (bottomLeft == null && bottomRight == null) ||
                (topLeft != null && bottomLeft == null) ||
                (topRight != null && bottomRight == null))
            {
                throw ReaderException.Instance;
            }

            this.Image = image;
            this.TopLeft = topLeft;
            this.TopRight = topRight;
            this.BottomLeft = bottomLeft;
            this.BottomRight = bottomRight;
            CalculateMinMaxValues();
        }
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:30,代码来源:BoundingBox.cs

示例7: orderBestPatterns

            /**
           * <p>Orders an array of three ResultPoints in an order [A,B,C] such that AB < AC and
           * BC < AC and the angle between BC and BA is less than 180 degrees.
           */
          public static void orderBestPatterns(ResultPoint[] patterns) {

            // Find distances between pattern centers
            float zeroOneDistance = distance(patterns[0], patterns[1]);
            float oneTwoDistance = distance(patterns[1], patterns[2]);
            float zeroTwoDistance = distance(patterns[0], patterns[2]);

            ResultPoint pointA, pointB, pointC;
            // Assume one closest to other two is B; A and C will just be guesses at first
            if (oneTwoDistance >= zeroOneDistance && oneTwoDistance >= zeroTwoDistance) {
              pointB = patterns[0];
              pointA = patterns[1];
              pointC = patterns[2];
            } else if (zeroTwoDistance >= oneTwoDistance && zeroTwoDistance >= zeroOneDistance) {
              pointB = patterns[1];
              pointA = patterns[0];
              pointC = patterns[2];
            } else {
              pointB = patterns[2];
              pointA = patterns[0];
              pointC = patterns[1];
            }

            // Use cross product to figure out whether A and C are correct or flipped.
            // This asks whether BC x BA has a positive z component, which is the arrangement
            // we want for A, B, C. If it's negative, then we've got it flipped around and
            // should swap A and C.
            if (crossProductZ(pointA, pointB, pointC) < 0.0f) {
              ResultPoint temp = pointA;
              pointA = pointC;
              pointC = temp;
            }

            patterns[0] = pointA;
            patterns[1] = pointB;
            patterns[2] = pointC;
          }
开发者ID:andrejpanic,项目名称:win-mobile-code,代码行数:41,代码来源:GenericResultPoint.cs

示例8: decode

 // Note that we don't try rotation without the try harder flag, even if rotation was supported.
 public virtual Result decode(BinaryBitmap image, System.Collections.Generic.Dictionary <Object,Object> hints)
 {
     try
     {
         return doDecode(image, hints);
     }
     catch (ReaderException re)
     {
         bool tryHarder = hints != null && hints.ContainsKey(DecodeHintType.TRY_HARDER);
         if (tryHarder && image.RotateSupported)
         {
             BinaryBitmap rotatedImage = image.rotateCounterClockwise();
             Result result = doDecode(rotatedImage, hints);
             // Record that we found it rotated 90 degrees CCW / 270 degrees CW
             System.Collections.Generic.Dictionary <Object,Object> metadata = result.ResultMetadata;
             int orientation = 270;
             if (metadata != null && metadata.ContainsKey(ResultMetadataType.ORIENTATION))
             {
                 // But if we found it reversed in doDecode(), add in that result here:
                 orientation = (orientation + ((System.Int32) metadata[ResultMetadataType.ORIENTATION])) % 360;
             }
             result.putMetadata(ResultMetadataType.ORIENTATION, (System.Object) orientation);
             // Update result points
             ResultPoint[] points = result.ResultPoints;
             int height = rotatedImage.Height;
             for (int i = 0; i < points.Length; i++)
             {
                 points[i] = new ResultPoint(height - points[i].Y - 1, points[i].X);
             }
             return result;
         }
         else
         {
             throw re;
         }
     }
 }
开发者ID:hankhongyi,项目名称:zxing_for_wp8,代码行数:38,代码来源:OneDReader.cs

示例9: doDecode

      /// <summary>
      /// We're going to examine rows from the middle outward, searching alternately above and below the
      /// middle, and farther out each time. rowStep is the number of rows between each successive
      /// attempt above and below the middle. So we'd scan row middle, then middle - rowStep, then
      /// middle + rowStep, then middle - (2 * rowStep), etc.
      /// rowStep is bigger as the image is taller, but is always at least 1. We've somewhat arbitrarily
      /// decided that moving up and down by about 1/16 of the image is pretty good; we try more of the
      /// image if "trying harder".
      /// </summary>
      /// <param name="image">The image to decode</param>
      /// <param name="hints">Any hints that were requested</param>
      /// <returns>The contents of the decoded barcode</returns>
      virtual protected Result doDecode(BinaryBitmap image, IDictionary<DecodeHintType, object> hints)
      {
         int width = image.Width;
         int height = image.Height;
         BitArray row = new BitArray(width);

         int middle = height >> 1;
         bool tryHarder = hints != null && hints.ContainsKey(DecodeHintType.TRY_HARDER);
         int rowStep = Math.Max(1, height >> (tryHarder ? 8 : 5));
         int maxLines;
         if (tryHarder)
         {
            maxLines = height; // Look at the whole image, not just the center
         }
         else
         {
            maxLines = 15; // 15 rows spaced 1/32 apart is roughly the middle half of the image
         }

         for (int x = 0; x < maxLines; x++)
         {

            // Scanning from the middle out. Determine which row we're looking at next:
            int rowStepsAboveOrBelow = (x + 1) >> 1;
            bool isAbove = (x & 0x01) == 0; // i.e. is x even?
            int rowNumber = middle + rowStep * (isAbove ? rowStepsAboveOrBelow : -rowStepsAboveOrBelow);
            if (rowNumber < 0 || rowNumber >= height)
            {
               // Oops, if we run off the top or bottom, stop
               break;
            }

            // Estimate black point for this row and load it:
            row = image.getBlackRow(rowNumber, row);
            if (row == null)
               continue;

            // While we have the image data in a BitArray, it's fairly cheap to reverse it in place to
            // handle decoding upside down barcodes.
            for (int attempt = 0; attempt < 2; attempt++)
            {
               if (attempt == 1)
               { 
                  // trying again?
                  row.reverse(); // reverse the row and continue
                  // This means we will only ever draw result points *once* in the life of this method
                  // since we want to avoid drawing the wrong points after flipping the row, and,
                  // don't want to clutter with noise from every single row scan -- just the scans
                  // that start on the center line.
                  if (hints != null && hints.ContainsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK))
                  {
                     IDictionary<DecodeHintType, Object> newHints = new Dictionary<DecodeHintType, Object>();
                     foreach (var hint in hints)
                     {
                        if (hint.Key != DecodeHintType.NEED_RESULT_POINT_CALLBACK)
                           newHints.Add(hint.Key, hint.Value);
                     }
                     hints = newHints;
                  }
               }
               // Look for a barcode
               Result result = decodeRow(rowNumber, row, hints);
               if (result == null)
                  continue;

               // We found our barcode
               if (attempt == 1)
               {
                  // But it was upside down, so note that
                  result.putMetadata(ResultMetadataType.ORIENTATION, 180);
                  // And remember to flip the result points horizontally.
                  ResultPoint[] points = result.ResultPoints;
                  if (points != null)
                  {
                     points[0] = new ResultPoint(width - points[0].X - 1, points[0].Y);
                     points[1] = new ResultPoint(width - points[1].X - 1, points[1].Y);
                  }
               }
               return result;
            }
         }

         return null;
      }
开发者ID:arumata,项目名称:zxingnet,代码行数:96,代码来源:OneDReader(4).cs

示例10: SetTopRight

 /// <summary>
 /// If we adjust the width, set a new right corner coordinate and recalculate
 /// </summary>
 /// <param name="topRight">Top right.</param>
 internal void SetTopRight(ResultPoint topRight)
 {
     this.TopRight = topRight;
     CalculateMinMaxValues();
 }
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:9,代码来源:BoundingBox.cs

示例11: processFinderPatternInfo

      /// <summary>
      /// Processes the finder pattern info.
      /// </summary>
      /// <param name="info">The info.</param>
      /// <returns></returns>
      protected internal virtual DetectorResult processFinderPatternInfo(FinderPatternInfo info)
      {
         FinderPattern topLeft = info.TopLeft;
         FinderPattern topRight = info.TopRight;
         FinderPattern bottomLeft = info.BottomLeft;

         float moduleSize = calculateModuleSize(topLeft, topRight, bottomLeft);
         if (moduleSize < 1.0f)
         {
            return null;
         }
         int dimension;
         if (!computeDimension(topLeft, topRight, bottomLeft, moduleSize, out dimension))
            return null;
         Internal.Version provisionalVersion = Internal.Version.getProvisionalVersionForDimension(dimension);
         if (provisionalVersion == null)
            return null;
         int modulesBetweenFPCenters = provisionalVersion.DimensionForVersion - 7;

         AlignmentPattern alignmentPattern = null;
         // Anything above version 1 has an alignment pattern
         if (provisionalVersion.AlignmentPatternCenters.Length > 0)
         {

            // Guess where a "bottom right" finder pattern would have been
            float bottomRightX = topRight.X - topLeft.X + bottomLeft.X;
            float bottomRightY = topRight.Y - topLeft.Y + bottomLeft.Y;

            // Estimate that alignment pattern is closer by 3 modules
            // from "bottom right" to known top left location
            //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 correctionToTopLeft = 1.0f - 3.0f / (float)modulesBetweenFPCenters;
            //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'"
            int estAlignmentX = (int)(topLeft.X + correctionToTopLeft * (bottomRightX - topLeft.X));
            //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'"
            int estAlignmentY = (int)(topLeft.Y + correctionToTopLeft * (bottomRightY - topLeft.Y));

            // Kind of arbitrary -- expand search radius before giving up
            for (int i = 4; i <= 16; i <<= 1)
            {
               alignmentPattern = findAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, (float)i);
               if (alignmentPattern == null)
                  continue;
               break;
            }
            // If we didn't find alignment pattern... well try anyway without it
         }

         PerspectiveTransform transform = createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);

         BitMatrix bits = sampleGrid(image, transform, dimension);
         if (bits == null)
            return null;

         ResultPoint[] points;
         if (alignmentPattern == null)
         {
            points = new ResultPoint[] { bottomLeft, topLeft, topRight };
         }
         else
         {
            points = new ResultPoint[] { bottomLeft, topLeft, topRight, alignmentPattern };
         }
         return new DetectorResult(bits, points);
      }
开发者ID:n1rvana,项目名称:ZXing.NET,代码行数:70,代码来源:Detector.cs

示例12: calculateModuleSizeOneWay

 /// <summary> <p>Estimates module size based on two finder patterns -- it uses
 /// {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the
 /// width of each, measuring along the axis between their centers.</p>
 /// </summary>
 private float calculateModuleSizeOneWay(ResultPoint pattern, ResultPoint otherPattern)
 {
    //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 moduleSizeEst1 = sizeOfBlackWhiteBlackRunBothWays((int)pattern.X, (int)pattern.Y, (int)otherPattern.X, (int)otherPattern.Y);
    //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 moduleSizeEst2 = sizeOfBlackWhiteBlackRunBothWays((int)otherPattern.X, (int)otherPattern.Y, (int)pattern.X, (int)pattern.Y);
    if (Single.IsNaN(moduleSizeEst1))
    {
       return moduleSizeEst2 / 7.0f;
    }
    if (Single.IsNaN(moduleSizeEst2))
    {
       return moduleSizeEst1 / 7.0f;
    }
    // Average them, and divide by 7 since we've counted the width of 3 black modules,
    // and 1 white and 1 black module on either side. Ergo, divide sum by 14.
    return (moduleSizeEst1 + moduleSizeEst2) / 14.0f;
 }
开发者ID:Bogdan-p,项目名称:ZXing.Net,代码行数:22,代码来源:Detector.cs

示例13: calculateModuleSize

 /// <summary> <p>Computes an average estimated module size based on estimated derived from the positions
 /// of the three finder patterns.</p>
 /// </summary>
 protected internal virtual float calculateModuleSize(ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft)
 {
    // Take the average
    return (calculateModuleSizeOneWay(topLeft, topRight) + calculateModuleSizeOneWay(topLeft, bottomLeft)) / 2.0f;
 }
开发者ID:Bogdan-p,项目名称:ZXing.Net,代码行数:8,代码来源:Detector.cs

示例14: computeDimension

 /// <summary> <p>Computes the dimension (number of modules on a size) of the QR Code based on the position
 /// of the finder patterns and estimated module size.</p>
 /// </summary>
 private static bool computeDimension(ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft, float moduleSize, out int dimension)
 {
    int tltrCentersDimension = MathUtils.round(ResultPoint.distance(topLeft, topRight) / moduleSize);
    int tlblCentersDimension = MathUtils.round(ResultPoint.distance(topLeft, bottomLeft) / moduleSize);
    dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7;
    switch (dimension & 0x03)
    {
       // mod 4
       case 0:
          dimension++;
          break;
       // 1? do nothing
       case 2:
          dimension--;
          break;
       case 3:
          return true;
    }
    return true;
 }
开发者ID:Bogdan-p,项目名称:ZXing.Net,代码行数:23,代码来源:Detector.cs

示例15: getRowIndicatorColumn

 /// <summary>
 /// Gets the row indicator column.
 /// </summary>
 /// <returns>The row indicator column.</returns>
 /// <param name="image">Image.</param>
 /// <param name="boundingBox">Bounding box.</param>
 /// <param name="startPoint">Start point.</param>
 /// <param name="leftToRight">If set to <c>true</c> left to right.</param>
 /// <param name="minCodewordWidth">Minimum codeword width.</param>
 /// <param name="maxCodewordWidth">Max codeword width.</param>
 private static DetectionResultRowIndicatorColumn getRowIndicatorColumn(BitMatrix image,
                                                                        BoundingBox boundingBox,
                                                                        ResultPoint startPoint,
                                                                        bool leftToRight,
                                                                        int minCodewordWidth,
                                                                        int maxCodewordWidth)
 {
    DetectionResultRowIndicatorColumn rowIndicatorColumn = new DetectionResultRowIndicatorColumn(boundingBox, leftToRight);
    for (int i = 0; i < 2; i++)
    {
       int increment = i == 0 ? 1 : -1;
       int startColumn = (int) startPoint.X;
       for (int imageRow = (int) startPoint.Y; imageRow <= boundingBox.MaxY &&
                                               imageRow >= boundingBox.MinY; imageRow += increment)
       {
          Codeword codeword = detectCodeword(image, 0, image.Width, leftToRight, startColumn, imageRow,
                                             minCodewordWidth, maxCodewordWidth);
          if (codeword != null)
          {
             rowIndicatorColumn.setCodeword(imageRow, codeword);
             if (leftToRight)
             {
                startColumn = codeword.StartX;
             }
             else
             {
                startColumn = codeword.EndX;
             }
          }
       }
    }
    return rowIndicatorColumn;
 }
开发者ID:Woo-Long,项目名称:ZXing.Net.Mobile,代码行数:43,代码来源:PDF417ScanningDecoder.cs


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