mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Merge c2433d2582
into 2a779a9586
This commit is contained in:
commit
fdae47a001
|
@ -83,7 +83,31 @@ public final class WhiteRectangleDetector {
|
|||
* @throws NotFoundException if no Data Matrix Code can be found
|
||||
*/
|
||||
public ResultPoint[] detect() throws NotFoundException {
|
||||
|
||||
if( this.tryHarder ) {
|
||||
try {
|
||||
return this.internalDetect();
|
||||
}
|
||||
catch( NotFoundException e ) {
|
||||
for( int x=0; x < image.getWidth(); x += 50 ) {
|
||||
for( int y=0; y < image.getHeight(); y += 50 ) {
|
||||
try {
|
||||
return new WhiteRectangleDetector( image, INIT_SIZE, x, y ).internalDetect();
|
||||
}
|
||||
catch( NotFoundException nfe ) {
|
||||
//Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
//also try harder did not found anything
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return this.internalDetect();
|
||||
}
|
||||
}
|
||||
|
||||
protected ResultPoint[] internalDetect() throws NotFoundException {
|
||||
int left = leftInit;
|
||||
int right = rightInit;
|
||||
int up = upInit;
|
||||
|
|
Loading…
Reference in a new issue