mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Should fix problems decoding tiny QR codes without any alignment pattern
git-svn-id: https://zxing.googlecode.com/svn/trunk@63 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
a164858fe4
commit
b53b6f27cc
|
@ -31,25 +31,27 @@ public final class DefaultGridSampler extends GridSampler {
|
||||||
FinderPattern bottomLeft,
|
FinderPattern bottomLeft,
|
||||||
AlignmentPattern alignmentPattern,
|
AlignmentPattern alignmentPattern,
|
||||||
int dimension) throws ReaderException {
|
int dimension) throws ReaderException {
|
||||||
float bottomRightX;
|
float dimMinusThree = (float) dimension - 3.5f;
|
||||||
float bottomRightY;
|
float bottomRightX, bottomRightY;
|
||||||
|
float sourceBottomRightX, sourceBottomRightY;
|
||||||
if (alignmentPattern != null) {
|
if (alignmentPattern != null) {
|
||||||
bottomRightX = alignmentPattern.getX();
|
bottomRightX = alignmentPattern.getX();
|
||||||
bottomRightY = alignmentPattern.getY();
|
bottomRightY = alignmentPattern.getY();
|
||||||
|
sourceBottomRightX = sourceBottomRightY = dimMinusThree - 3.0f;
|
||||||
} else {
|
} else {
|
||||||
// Don't have an alignment pattern, just make up the bottom-right point
|
// Don't have an alignment pattern, just make up the bottom-right point
|
||||||
bottomRightX = (topRight.getX() - topLeft.getX()) + bottomLeft.getX();
|
bottomRightX = (topRight.getX() - topLeft.getX()) + bottomLeft.getX();
|
||||||
bottomRightY = (topRight.getY() - topLeft.getY()) + bottomLeft.getY();
|
bottomRightY = (topRight.getY() - topLeft.getY()) + bottomLeft.getY();
|
||||||
|
sourceBottomRightX = sourceBottomRightY = dimMinusThree;
|
||||||
}
|
}
|
||||||
|
|
||||||
float dimMinusThree = (float) dimension - 3.5f;
|
|
||||||
PerspectiveTransform transform = PerspectiveTransform.quadrilateralToQuadrilateral(
|
PerspectiveTransform transform = PerspectiveTransform.quadrilateralToQuadrilateral(
|
||||||
3.5f,
|
3.5f,
|
||||||
3.5f,
|
3.5f,
|
||||||
dimMinusThree,
|
dimMinusThree,
|
||||||
3.5f,
|
3.5f,
|
||||||
dimMinusThree - 3.0f,
|
sourceBottomRightX,
|
||||||
dimMinusThree - 3.0f,
|
sourceBottomRightY,
|
||||||
3.5f,
|
3.5f,
|
||||||
dimMinusThree,
|
dimMinusThree,
|
||||||
topLeft.getX(),
|
topLeft.getX(),
|
||||||
|
|
Loading…
Reference in a new issue