Class MonochromeRectangleDetector

java.lang.Object
com.google.zxing.common.detector.MonochromeRectangleDetector

@Deprecated public final class MonochromeRectangleDetector extends Object
Deprecated.
without replacement since 3.3.0

A somewhat generic detector that looks for a barcode-like rectangular region within an image. It looks within a mostly white region of an image for a region of black and white, but mostly black. It returns the four corners of the region, as best it can determine.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final BitMatrix
    Deprecated.
     
    private static final int
    Deprecated.
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private int[]
    blackWhiteRange(int fixedDimension, int maxWhiteRun, int minDim, int maxDim, boolean horizontal)
    Deprecated.
    Computes the start and end of a region of pixels, either horizontally or vertically, that could be part of a Data Matrix barcode.
    Deprecated.
    Detects a rectangular region of black and white -- mostly black -- with a region of mostly white, in an image.
    private ResultPoint
    findCornerFromCenter(int centerX, int deltaX, int left, int right, int centerY, int deltaY, int top, int bottom, int maxWhiteRun)
    Deprecated.
    Attempts to locate a corner of the barcode by scanning up, down, left or right from a center point which should be within the barcode.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • MonochromeRectangleDetector

      public MonochromeRectangleDetector(BitMatrix image)
      Deprecated.
  • Method Details

    • detect

      public ResultPoint[] detect() throws NotFoundException
      Deprecated.

      Detects a rectangular region of black and white -- mostly black -- with a region of mostly white, in an image.

      Returns:
      ResultPoint[] describing the corners of the rectangular region. The first and last points are opposed on the diagonal, as are the second and third. The first point will be the topmost point and the last, the bottommost. The second point will be leftmost and the third, the rightmost
      Throws:
      NotFoundException - if no Data Matrix Code can be found
    • findCornerFromCenter

      private ResultPoint findCornerFromCenter(int centerX, int deltaX, int left, int right, int centerY, int deltaY, int top, int bottom, int maxWhiteRun) throws NotFoundException
      Deprecated.
      Attempts to locate a corner of the barcode by scanning up, down, left or right from a center point which should be within the barcode.
      Parameters:
      centerX - center's x component (horizontal)
      deltaX - same as deltaY but change in x per step instead
      left - minimum value of x
      right - maximum value of x
      centerY - center's y component (vertical)
      deltaY - change in y per step. If scanning up this is negative; down, positive; left or right, 0
      top - minimum value of y to search through (meaningless when di == 0)
      bottom - maximum value of y
      maxWhiteRun - maximum run of white pixels that can still be considered to be within the barcode
      Returns:
      a ResultPoint encapsulating the corner that was found
      Throws:
      NotFoundException - if such a point cannot be found
    • blackWhiteRange

      private int[] blackWhiteRange(int fixedDimension, int maxWhiteRun, int minDim, int maxDim, boolean horizontal)
      Deprecated.
      Computes the start and end of a region of pixels, either horizontally or vertically, that could be part of a Data Matrix barcode.
      Parameters:
      fixedDimension - if scanning horizontally, this is the row (the fixed vertical location) where we are scanning. If scanning vertically it's the column, the fixed horizontal location
      maxWhiteRun - largest run of white pixels that can still be considered part of the barcode region
      minDim - minimum pixel location, horizontally or vertically, to consider
      maxDim - maximum pixel location, horizontally or vertically, to consider
      horizontal - if true, we're scanning left-right, instead of up-down
      Returns:
      int[] with start and end of found range, or null if no such range is found (e.g. only white was found)