Package com.google.zxing.common.detector
Class MonochromeRectangleDetector
java.lang.Object
com.google.zxing.common.detector.MonochromeRectangleDetector
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
FieldsModifier and TypeFieldDescriptionprivate final BitMatrix
Deprecated.private static final int
Deprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate 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.detect()
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.
-
Field Details
-
MAX_MODULES
private static final int MAX_MODULESDeprecated.- See Also:
-
image
Deprecated.
-
-
Constructor Details
-
MonochromeRectangleDetector
Deprecated.
-
-
Method Details
-
detect
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 insteadleft
- minimum value of xright
- maximum value of xcenterY
- center's y component (vertical)deltaY
- change in y per step. If scanning up this is negative; down, positive; left or right, 0top
- minimum value of y to search through (meaningless when di == 0)bottom
- maximum value of ymaxWhiteRun
- 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 locationmaxWhiteRun
- largest run of white pixels that can still be considered part of the barcode regionminDim
- minimum pixel location, horizontally or vertically, to considermaxDim
- maximum pixel location, horizontally or vertically, to considerhorizontal
- 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)
-