Revert "Add hint to correct wrong dimension"

This reverts commit 16723b3434.
This commit is contained in:
Matthias Agethle 2025-02-03 14:30:29 +01:00
parent 16723b3434
commit 36f340dab3
3 changed files with 6 additions and 25 deletions

View file

@ -104,19 +104,6 @@ public enum DecodeHintType {
*/
ALSO_INVERTED(Void.class),
/**
* If true, it will round down wrong dimension to next possible value.
* Doesn't matter what it maps to; use {@link Boolean#TRUE}.
*/
CORRECT_DIMENSION_TO_LOWER_VALUE(Void.class),
/**
* If true, it will round up wrong dimension to next possible value.
* Doesn't matter what it maps to; use {@link Boolean#TRUE}.
*/
CORRECT_DIMENSION_TO_UPPER_VALUE(Void.class),
// End of enumeration values.
;

View file

@ -58,7 +58,7 @@ public final class MultiDetector extends Detector {
List<DetectorResult> result = new ArrayList<>();
for (FinderPatternInfo info : infos) {
try {
result.add(processFinderPatternInfo(info, hints));
result.add(processFinderPatternInfo(info));
} catch (ReaderException e) {
// ignore
}

View file

@ -80,10 +80,10 @@ public class Detector {
FinderPatternFinder finder = new FinderPatternFinder(image, resultPointCallback);
FinderPatternInfo info = finder.find(hints);
return processFinderPatternInfo(info, hints);
return processFinderPatternInfo(info);
}
protected final DetectorResult processFinderPatternInfo(FinderPatternInfo info, Map<DecodeHintType,?> hints)
protected final DetectorResult processFinderPatternInfo(FinderPatternInfo info)
throws NotFoundException, FormatException {
FinderPattern topLeft = info.getTopLeft();
@ -94,7 +94,7 @@ public class Detector {
if (moduleSize < 1.0f) {
throw NotFoundException.getNotFoundInstance();
}
int dimension = computeDimension(topLeft, topRight, bottomLeft, moduleSize, hints);
int dimension = computeDimension(topLeft, topRight, bottomLeft, moduleSize);
Version provisionalVersion = Version.getProvisionalVersionForDimension(dimension);
int modulesBetweenFPCenters = provisionalVersion.getDimensionForVersion() - 7;
@ -198,8 +198,7 @@ public class Detector {
private static int computeDimension(ResultPoint topLeft,
ResultPoint topRight,
ResultPoint bottomLeft,
float moduleSize,
Map<DecodeHintType,?> hints) throws NotFoundException {
float moduleSize) throws NotFoundException {
int tltrCentersDimension = MathUtils.round(ResultPoint.distance(topLeft, topRight) / moduleSize);
int tlblCentersDimension = MathUtils.round(ResultPoint.distance(topLeft, bottomLeft) / moduleSize);
int dimension = ((tltrCentersDimension + tlblCentersDimension) / 2) + 7;
@ -212,12 +211,7 @@ public class Detector {
dimension--;
break;
case 3:
if (hints != null && hints.get(DecodeHintType.CORRECT_DIMENSION_TO_LOWER_VALUE)!=null)
dimension = dimension - 2;
else if (hints != null && hints.get(DecodeHintType.CORRECT_DIMENSION_TO_UPPER_VALUE)!=null)
dimension = dimension + 2;
else
throw NotFoundException.getNotFoundInstance();
throw NotFoundException.getNotFoundInstance();
}
return dimension;
}