Class Detector
java.lang.Object
com.google.zxing.datamatrix.detector.Detector
Encapsulates logic that can detect a Data Matrix Code in an image, even if the Data Matrix Code is rotated or skewed, or partially obscured.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ResultPoint
correctTopRight
(ResultPoint[] points) Calculates the corner position of the white top right module.detect()
Detects a Data Matrix Code in an image.private ResultPoint[]
detectSolid1
(ResultPoint[] cornerPoints) Detect a solid side which has minimum transition.private ResultPoint[]
detectSolid2
(ResultPoint[] points) Detect a second solid side next to first solid side.private boolean
private static ResultPoint
moveAway
(ResultPoint point, float fromX, float fromY) private static BitMatrix
sampleGrid
(BitMatrix image, ResultPoint topLeft, ResultPoint bottomLeft, ResultPoint bottomRight, ResultPoint topRight, int dimensionX, int dimensionY) private static ResultPoint
shiftPoint
(ResultPoint point, ResultPoint to, int div) private ResultPoint[]
shiftToModuleCenter
(ResultPoint[] points) Shift the edge points to the module center.private int
transitionsBetween
(ResultPoint from, ResultPoint to) Counts the number of black/white transitions between two points, using something like Bresenham's algorithm.
-
Field Details
-
image
-
rectangleDetector
-
-
Constructor Details
-
Detector
- Throws:
NotFoundException
-
-
Method Details
-
detect
Detects a Data Matrix Code in an image.
- Returns:
DetectorResult
encapsulating results of detecting a Data Matrix Code- Throws:
NotFoundException
- if no Data Matrix Code can be found
-
shiftPoint
-
moveAway
-
detectSolid1
Detect a solid side which has minimum transition. -
detectSolid2
Detect a second solid side next to first solid side. -
correctTopRight
Calculates the corner position of the white top right module. -
shiftToModuleCenter
Shift the edge points to the module center. -
isValid
-
sampleGrid
private static BitMatrix sampleGrid(BitMatrix image, ResultPoint topLeft, ResultPoint bottomLeft, ResultPoint bottomRight, ResultPoint topRight, int dimensionX, int dimensionY) throws NotFoundException - Throws:
NotFoundException
-
transitionsBetween
Counts the number of black/white transitions between two points, using something like Bresenham's algorithm.
-