/** * <p>Attempts to locate an alignment pattern in a limited region of the image, which is * guessed to contain it. This method uses {@link AlignmentPattern}.</p> * * @param overallEstModuleSize estimated module size so far * @param estAlignmentX x coordinate of center of area probably containing alignment pattern * @param estAlignmentY y coordinate of above * @param allowanceFactor number of pixels in all directons to search from the center * @return {@link AlignmentPattern} if found, or null otherwise * @throws ReaderException if an unexpected error occurs during detection */ private AlignmentPattern findAlignmentInRegion(float overallEstModuleSize, int estAlignmentX, int estAlignmentY, float allowanceFactor) { // Look for an alignment pattern (3 modules in size) around where it // should be int allowance = (int)(allowanceFactor * overallEstModuleSize); int alignmentAreaLeftX = Math.Max(0, estAlignmentX - allowance); int alignmentAreaRightX = Math.Min(image.getWidth() - 1, estAlignmentX + allowance); if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) { throw new ReaderException(); } int alignmentAreaTopY = Math.Max(0, estAlignmentY - allowance); int alignmentAreaBottomY = Math.Min(image.getHeight() - 1, estAlignmentY + allowance); AlignmentPatternFinder alignmentFinder = new AlignmentPatternFinder( image, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize); return(alignmentFinder.find()); }
/// <summary> /// <p>Attempts to locate an alignment pattern in a limited region of the image, which is /// guessed to contain it. This method uses <seealso cref="AlignmentPattern"/>.</p> /// </summary> /// <param name="overallEstModuleSize"> estimated module size so far </param> /// <param name="estAlignmentX"> x coordinate of center of area probably containing alignment pattern </param> /// <param name="estAlignmentY"> y coordinate of above </param> /// <param name="allowanceFactor"> number of pixels in all directions to search from the center </param> /// <returns> <seealso cref="AlignmentPattern"/> if found, or null otherwise </returns> /// <exception cref="NotFoundException"> if an unexpected error occurs during detection </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected final AlignmentPattern findAlignmentInRegion(float overallEstModuleSize, int estAlignmentX, int estAlignmentY, float allowanceFactor) throws com.google.zxing.NotFoundException protected internal AlignmentPattern findAlignmentInRegion(float overallEstModuleSize, int estAlignmentX, int estAlignmentY, float allowanceFactor) { // Look for an alignment pattern (3 modules in size) around where it // should be int allowance = (int)(allowanceFactor * overallEstModuleSize); int alignmentAreaLeftX = Math.Max(0, estAlignmentX - allowance); int alignmentAreaRightX = Math.Min(image.Width - 1, estAlignmentX + allowance); if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) { throw NotFoundException.NotFoundInstance; } int alignmentAreaTopY = Math.Max(0, estAlignmentY - allowance); int alignmentAreaBottomY = Math.Min(image.Height - 1, estAlignmentY + allowance); if (alignmentAreaBottomY - alignmentAreaTopY < overallEstModuleSize * 3) { throw NotFoundException.NotFoundInstance; } AlignmentPatternFinder alignmentFinder = new AlignmentPatternFinder(image, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, resultPointCallback); return(alignmentFinder.find()); }
/// <summary> <p>Attempts to locate an alignment pattern in a limited region of the image, which is /// guessed to contain it. This method uses {@link AlignmentPattern}.</p> /// /// </summary> /// <param name="overallEstModuleSize">estimated module size so far /// </param> /// <param name="estAlignmentX">x coordinate of center of area probably containing alignment pattern /// </param> /// <param name="estAlignmentY">y coordinate of above /// </param> /// <param name="allowanceFactor">number of pixels in all directions to search from the center /// </param> /// <returns> {@link AlignmentPattern} if found, or null otherwise /// </returns> /// <throws> ReaderException if an unexpected error occurs during detection </throws> protected internal virtual AlignmentPattern findAlignmentInRegion(float overallEstModuleSize, int estAlignmentX, int estAlignmentY, float allowanceFactor) { // Look for an alignment pattern (3 modules in size) around where it // should be //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 allowance = (int)(allowanceFactor * overallEstModuleSize); int alignmentAreaLeftX = System.Math.Max(0, estAlignmentX - allowance); int alignmentAreaRightX = System.Math.Min(image.Width - 1, estAlignmentX + allowance); if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) { throw ReaderException.Instance; } int alignmentAreaTopY = System.Math.Max(0, estAlignmentY - allowance); int alignmentAreaBottomY = System.Math.Min(image.Height - 1, estAlignmentY + allowance); AlignmentPatternFinder alignmentFinder = new AlignmentPatternFinder(image, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, resultPointCallback); return(alignmentFinder.find()); }
/// <summary> <p>Attempts to locate an alignment pattern in a limited region of the image, which is /// guessed to contain it. This method uses {@link AlignmentPattern}.</p> /// /// </summary> /// <param name="overallEstModuleSize">estimated module size so far /// </param> /// <param name="estAlignmentX">x coordinate of center of area probably containing alignment pattern /// </param> /// <param name="estAlignmentY">y coordinate of above /// </param> /// <param name="allowanceFactor">number of pixels in all directions to search from the center /// </param> /// <returns> {@link AlignmentPattern} if found, or null otherwise /// </returns> /// <throws> ReaderException if an unexpected error occurs during detection </throws> protected internal virtual AlignmentPattern findAlignmentInRegion(float overallEstModuleSize, int estAlignmentX, int estAlignmentY, float allowanceFactor) { // Look for an alignment pattern (3 modules in size) around where it // should be //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 allowance = (int) (allowanceFactor * overallEstModuleSize); int alignmentAreaLeftX = System.Math.Max(0, estAlignmentX - allowance); int alignmentAreaRightX = System.Math.Min(image.Width - 1, estAlignmentX + allowance); if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) { throw ReaderException.Instance; } int alignmentAreaTopY = System.Math.Max(0, estAlignmentY - allowance); int alignmentAreaBottomY = System.Math.Min(image.Height - 1, estAlignmentY + allowance); AlignmentPatternFinder alignmentFinder = new AlignmentPatternFinder(image, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, resultPointCallback); return alignmentFinder.find(); }
/** * <p>Attempts to locate an alignment pattern in a limited region of the image, which is * guessed to contain it. This method uses {@link AlignmentPattern}.</p> * * @param overallEstModuleSize estimated module size so far * @param estAlignmentX x coordinate of center of area probably containing alignment pattern * @param estAlignmentY y coordinate of above * @param allowanceFactor number of pixels in all directons to search from the center * @return {@link AlignmentPattern} if found, or null otherwise * @throws ReaderException if an unexpected error occurs during detection */ private AlignmentPattern findAlignmentInRegion(float overallEstModuleSize, int estAlignmentX, int estAlignmentY, float allowanceFactor) { // Look for an alignment pattern (3 modules in size) around where it // should be int allowance = (int) (allowanceFactor * overallEstModuleSize); int alignmentAreaLeftX = Math.Max(0, estAlignmentX - allowance); int alignmentAreaRightX = Math.Min(image.getWidth() - 1, estAlignmentX + allowance); if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) { throw new ReaderException(); } int alignmentAreaTopY = Math.Max(0, estAlignmentY - allowance); int alignmentAreaBottomY = Math.Min(image.getHeight() - 1, estAlignmentY + allowance); AlignmentPatternFinder alignmentFinder = new AlignmentPatternFinder( image, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize); return alignmentFinder.find(); }
/// <summary> /// <p>Attempts to locate an alignment pattern in a limited region of the image, which is /// guessed to contain it. This method uses <seealso cref="AlignmentPattern"/>.</p> /// </summary> /// <param name="overallEstModuleSize"> estimated module size so far </param> /// <param name="estAlignmentX"> x coordinate of center of area probably containing alignment pattern </param> /// <param name="estAlignmentY"> y coordinate of above </param> /// <param name="allowanceFactor"> number of pixels in all directions to search from the center </param> /// <returns> <seealso cref="AlignmentPattern"/> if found, or null otherwise </returns> /// <exception cref="NotFoundException"> if an unexpected error occurs during detection </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected final AlignmentPattern findAlignmentInRegion(float overallEstModuleSize, int estAlignmentX, int estAlignmentY, float allowanceFactor) throws com.google.zxing.NotFoundException protected internal AlignmentPattern findAlignmentInRegion(float overallEstModuleSize, int estAlignmentX, int estAlignmentY, float allowanceFactor) { // Look for an alignment pattern (3 modules in size) around where it // should be int allowance = (int)(allowanceFactor * overallEstModuleSize); int alignmentAreaLeftX = Math.Max(0, estAlignmentX - allowance); int alignmentAreaRightX = Math.Min(image.Width - 1, estAlignmentX + allowance); if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) { throw NotFoundException.NotFoundInstance; } int alignmentAreaTopY = Math.Max(0, estAlignmentY - allowance); int alignmentAreaBottomY = Math.Min(image.Height - 1, estAlignmentY + allowance); if (alignmentAreaBottomY - alignmentAreaTopY < overallEstModuleSize * 3) { throw NotFoundException.NotFoundInstance; } AlignmentPatternFinder alignmentFinder = new AlignmentPatternFinder(image, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, resultPointCallback); return alignmentFinder.find(); }