mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Update WhiteRectangleDetector.java
Changed image-only version of the constructor to calculate an appropriate initSize based on the image dimensions.
This commit is contained in:
parent
b8fc4ebf16
commit
78e2ac4522
|
@ -32,7 +32,8 @@ import com.google.zxing.common.BitMatrix;
|
|||
*/
|
||||
public final class WhiteRectangleDetector {
|
||||
|
||||
private static final int INIT_SIZE = 10;
|
||||
private static final float MIN_PCNT = 0.1;
|
||||
private static final int MIN_SIZE = 10;
|
||||
private static final int CORR = 1;
|
||||
|
||||
private final BitMatrix image;
|
||||
|
@ -44,7 +45,10 @@ public final class WhiteRectangleDetector {
|
|||
private final int upInit;
|
||||
|
||||
public WhiteRectangleDetector(BitMatrix image) throws NotFoundException {
|
||||
this(image, INIT_SIZE, image.getWidth() / 2, image.getHeight() / 2);
|
||||
int maxImageDimension = Math.max(image.getHeight, image.getWidth());
|
||||
int pcntBasedInitSize = maxImageDimension * MIN_PCNT;
|
||||
int initSize = Math.max(pcntBasedInitSize, MIN_SIZE));
|
||||
this(image, initSize, image.getWidth() / 2, image.getHeight() / 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -318,4 +322,4 @@ public final class WhiteRectangleDetector {
|
|||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue