@Deprecated
public final class MonochromeRectangleDetector
extends java.lang.Object
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.
Modifier and Type | Field and Description |
---|---|
private BitMatrix |
image
Deprecated.
|
private static int |
MAX_MODULES
Deprecated.
|
Constructor and Description |
---|
MonochromeRectangleDetector(BitMatrix image)
Deprecated.
|
Modifier and Type | Method and 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.
|
ResultPoint[] |
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.
|
private static final int MAX_MODULES
private final BitMatrix image
public MonochromeRectangleDetector(BitMatrix image)
public ResultPoint[] detect() throws NotFoundException
Detects a rectangular region of black and white -- mostly black -- with a region of mostly white, in an image.
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 rightmostNotFoundException
- if no Data Matrix Code can be foundprivate ResultPoint findCornerFromCenter(int centerX, int deltaX, int left, int right, int centerY, int deltaY, int top, int bottom, int maxWhiteRun) throws NotFoundException
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 barcodeResultPoint
encapsulating the corner that was foundNotFoundException
- if such a point cannot be foundprivate int[] blackWhiteRange(int fixedDimension, int maxWhiteRun, int minDim, int maxDim, boolean horizontal)
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