mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -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.
|
* Implements decoding of the ITF format.
|
||||||
* </p>
|
* </p>
|
||||||
*<p>
|
*<p>
|
||||||
* "ITF" stands for Interleaved Two of Five. This Reader will scan an arbritary
|
* "ITF" stands for Interleaved Two of Five. This Reader will scan ITF barcode with 6, 10 or 14 digits.
|
||||||
* ITF length barcode. The checksum is optional and is not applied by this
|
* The checksum is optional and is not applied by this Reader. The consumer of the decoded value will have to apply a checksum if
|
||||||
* Reader. The user of the decoded value will have to apply a checksum if
|
|
||||||
* required.
|
* required.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
|
@ -43,7 +42,7 @@ import java.util.Hashtable;
|
||||||
* information.
|
* information.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author kevin.osullivan@sita.aero
|
* @author kevin.osullivan@sita.aero, SITA Lab.
|
||||||
*/
|
*/
|
||||||
public class ITFReader extends AbstractOneDReader {
|
public class ITFReader extends AbstractOneDReader {
|
||||||
|
|
||||||
|
@ -94,10 +93,11 @@ public class ITFReader extends AbstractOneDReader {
|
||||||
|
|
||||||
String resultString = result.toString();
|
String resultString = result.toString();
|
||||||
/**
|
/**
|
||||||
* To avoid false positives with 2D barcodes, make
|
* To avoid false positives with 2D barcodes (and other patterns), make
|
||||||
* an assumption that the decoded string must be at least 6 digits.
|
* 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();
|
throw ReaderException.getInstance();
|
||||||
|
|
||||||
return new Result(resultString,
|
return new Result(resultString,
|
||||||
|
@ -173,10 +173,6 @@ public class ITFReader extends AbstractOneDReader {
|
||||||
return startPattern;
|
return startPattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* The start & end patterns must be pre/post fixed by a quiet zone. This
|
* 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.
|
// Unable to find the necessary number of quiet zone pixels.
|
||||||
throw ReaderException.getInstance();
|
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