mirror of
https://github.com/zxing/zxing.git
synced 2025-01-27 11:01:00 -08:00
Changes to fix high nbr of false positives. - Removed requirement that the barcode fills the viewfinder - Extended the check on the lenght of decoded barcode - now only 6, 10 and 14 digit barcodes are supported. git-svn-id: https://zxing.googlecode.com/svn/trunk@756 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
85506667a7
commit
afdc4508b7
|
@ -30,9 +30,8 @@ import java.util.Hashtable;
|
|||
* Implements decoding of the ITF format.
|
||||
* </p>
|
||||
*<p>
|
||||
* "ITF" stands for Interleaved Two of Five. This Reader will scan an arbritary
|
||||
* ITF length barcode. The checksum is optional and is not applied by this
|
||||
* Reader. The user of the decoded value will have to apply a checksum if
|
||||
* "ITF" stands for Interleaved Two of Five. This Reader will scan ITF barcode with 6, 10 or 14 digits.
|
||||
* The checksum is optional and is not applied by this Reader. The consumer of the decoded value will have to apply a checksum if
|
||||
* required.
|
||||
* </p>
|
||||
*
|
||||
|
@ -43,7 +42,7 @@ import java.util.Hashtable;
|
|||
* information.
|
||||
* </p>
|
||||
*
|
||||
* @author kevin.osullivan@sita.aero
|
||||
* @author kevin.osullivan@sita.aero, SITA Lab.
|
||||
*/
|
||||
public class ITFReader extends AbstractOneDReader {
|
||||
|
||||
|
@ -94,10 +93,11 @@ public class ITFReader extends AbstractOneDReader {
|
|||
|
||||
String resultString = result.toString();
|
||||
/**
|
||||
* To avoid false positives with 2D barcodes, make
|
||||
* an assumption that the decoded string must be at least 6 digits.
|
||||
* To avoid false positives with 2D barcodes (and other patterns), make
|
||||
* an assumption that the decoded string must be 6, 10 or 14 digits.
|
||||
*/
|
||||
if (resultString.length() < 6 || resultString.length() % 2 == 1)
|
||||
if ((resultString.length() != 6 && resultString.length() != 10 && resultString.length() != 14) ||
|
||||
resultString.length() % 2 == 1)
|
||||
throw ReaderException.getInstance();
|
||||
|
||||
return new Result(resultString,
|
||||
|
@ -173,10 +173,6 @@ public class ITFReader extends AbstractOneDReader {
|
|||
return startPattern;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* The start & end patterns must be pre/post fixed by a quiet zone. This
|
||||
|
@ -209,15 +205,6 @@ public class ITFReader extends AbstractOneDReader {
|
|||
// Unable to find the necessary number of quiet zone pixels.
|
||||
throw ReaderException.getInstance();
|
||||
}
|
||||
|
||||
if (i>this.narrowLineWidth*20)
|
||||
{
|
||||
// The distance from the image edge to the start of the quiet zone
|
||||
// is twice the size of the quiet zone.
|
||||
// This is unrealistic as the barcode should mostly fill the camera viewfinder.
|
||||
// This implies that this is a false positive.
|
||||
throw ReaderException.getInstance();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue