public class BarCodeReader
extends java.lang.Object
BarCodeReader encapsulates an image which may contain one or several barcodes, it then can perform ReadBarCodes operation to detect barcodes.
This sample shows how to detect Code39 and Code128 barcodes.BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }
Constructor and Description |
---|
BarCodeReader()
Initializes a new instance of the
BarCodeReader class with default values. |
BarCodeReader(Bitmap image)
Initializes a new instance of the
BarCodeReader class from an image. |
BarCodeReader(Bitmap image,
BaseDecodeType... decodeTypes)
Initializes a new instance of the
BarCodeReader class. |
BarCodeReader(Bitmap image,
BaseDecodeType type)
Initializes a new instance of the
BarCodeReader class. |
BarCodeReader(Bitmap image,
Rect[] areas,
BaseDecodeType type)
Initializes a new instance of the
BarCodeReader class. |
BarCodeReader(Bitmap image,
Rect area,
BaseDecodeType... decodeTypes)
Initializes a new instance of the
BarCodeReader class. |
BarCodeReader(Bitmap image,
Rect area,
BaseDecodeType type) |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Function requests termination of current recognition session from other thread.
|
void |
close()
Deprecated.
|
void |
dispose() |
float |
getAngle()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getRegion().getAngle() instead.
|
BaseDecodeType |
getBarCodeDecodeType() |
java.lang.String |
getCheckSum()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getExtended().getOneD().getCheckSum() instead.
|
ChecksumValidation |
getChecksumValidation() |
Code128DataPortion[] |
getCode128DataPortions()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getExtended().getCode128().getCode128DataPortions() instead.
|
byte[] |
getCodeBytes()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getCodeBytes() instead.
|
java.lang.String |
getCodeText()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getCodeText() instead.
|
java.lang.String |
getCodeText(boolean includeCheckSum)
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getCodeText() instead.
|
java.lang.String |
getCodeText(java.nio.charset.Charset encoding)
Deprecated.
This method is obsolete. Call BarCodeReader.getFoundBarCodes()[].getCodeText() instead.
|
SingleDecodeType |
getCodeType()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getCodeType() instead.
|
java.lang.String |
getCodeTypeName()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getCodeTypeName() instead.
|
CustomerInformationInterpretingType |
getCustomerInformationInterpretingType()
Gets the Interpreting Type for the Customer Information of AustralianPost BarCode.Default is CustomerInformationInterpretingType.OTHER.
|
boolean |
getDetectEncoding()
Deprecated.
|
BarCodeResult[] |
getFoundBarCodes()
Gets recognized
BarCodeResult s array |
int |
getFoundCount()
Gets recognized barcodes count
|
boolean |
getIsDeniable()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getConfidence() instead.
|
java.lang.String |
getMacroPdf417FileID()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getExtended().getPdf417().getMacroPdf417FileID() instead.
|
int |
getMacroPdf417SegmentID()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getExtended().getPdf417().getMacroPdf417SegmentID() instead.
|
int |
getMacroPdf417SegmentsCount()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getExtended().getPdf417().getMacroPdf417SegmentsCount() instead.
|
static ProcessorSettings |
getProcessorSettings()
Gets a settings of using processor cores.
|
int |
getQRStructuredAppendModeBarCodeIndex()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getExtended().getQR().getQRStructuredAppendModeBarCodeIndex() instead.
|
int |
getQRStructuredAppendModeBarCodesQuantity()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getExtended().getQR().getQRStructuredAppendModeBarCodesQuantity() instead.
|
int |
getQRStructuredAppendModeParityData()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getExtended().getQR().getQRStructuredAppendModeParityData() instead.
|
QualitySettings |
getQualitySettings()
QualitySettings allows to configure recognition quality and speed manually.
|
float |
getRecognitionQuality()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getReadingQuality() instead.
|
BarCodeRegion |
getRegion()
Deprecated.
This method is obsolete. Use BarCodeReader.getFoundBarCodes()[].getRegion() instead.
|
boolean |
getStripFNC()
Strip FNC1, FNC2, FNC3 characters from codetext.
|
int |
getTimeout()
Gets the timeout of recognition process in milliseconds.
|
boolean |
read()
Deprecated.
This method is obsolete. Call BarCodeReader.ReadBarCodes() instead.
|
BarCodeResult[] |
readBarCodes()
Reads
BarCodeResult s from the image. |
void |
setBarCodeImage(Bitmap value)
Sets bitmap image for recognition.
|
void |
setBarCodeImage(Bitmap value,
Rect area)
Sets bitmap image and area for recognition.
|
void |
setBarCodeImage(Bitmap value,
Rect[] areas)
Sets bitmap image and areas for recognition.
|
void |
setBarCodeImage(java.io.InputStream stream)
Sets image stream for recognition.
|
void |
setBarCodeReadType(BaseDecodeType type)
Sets decode type for recognition.
|
void |
setBarCodeReadType(SingleDecodeType... barcodeTypes)
Sets
SingleDecodeType type array for recognition. |
void |
setChecksumValidation(ChecksumValidation value) |
void |
setChecksumValidation(int value)
Deprecated.
|
void |
setCustomerInformationInterpretingType(CustomerInformationInterpretingType value)
Sets the Interpreting Type for the Customer Information of AustralianPost BarCode.Default is CustomerInformationInterpretingType.OTHER.
|
void |
setCustomerInformationInterpretingType(int value)
Sets the Interpreting Type for the Customer Information of AustralianPost BarCode.Default is CustomerInformationInterpretingType.OTHER.
|
void |
setDetectEncoding(boolean value)
Deprecated.
|
void |
setQualitySettings(QualitySettings value)
QualitySettings allows to configure recognition quality and speed manually.
|
void |
setStripFNC(boolean value)
Strip FNC1, FNC2, FNC3 characters from codetext.
|
void |
setTimeout(int value)
Sets the timeout of recognition process in milliseconds.
|
public BarCodeReader()
Initializes a new instance of the BarCodeReader
class with default values.
Requires to set image (SetBitmapImage()) before to call ReadBarCodes() method.
This sample shows how to detect Code39 and Code128 barcodes.BarCodeReader reader = new BarCodeReader(); reader.setBarCodeReadType(DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); reader.setBarCodeImage("test.png"); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }
public BarCodeReader(Bitmap image)
Initializes a new instance of the BarCodeReader
class from an image.
This sample shows how to detect Code39 and Code128 barcodes.Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader(bmp); reader.setBarCodeReadType(DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }
image
- A Bitmap instance containing the imagepublic BarCodeReader(Bitmap image, BaseDecodeType... decodeTypes)
Initializes a new instance of the BarCodeReader
class.
This sample shows how to detect Code39 and Code128 barcodes.Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader(bmp, DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }
image
- The image.decodeTypes
- Decode types.public BarCodeReader(Bitmap image, BaseDecodeType type)
Initializes a new instance of the BarCodeReader
class.
This sample shows how to detect Code39 and Code128 barcodes.Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader(bmp, new MultyDecodeType(DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }
image
- The image.type
- The decode type1. It can be single or multypublic BarCodeReader(Bitmap image, Rect area, BaseDecodeType... decodeTypes)
Initializes a new instance of the BarCodeReader
class.
This sample shows how to detect Code39 and Code128 barcodes.Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight()), DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }
image
- The image.area
- The area for recognition.decodeTypes
- Decode types.public BarCodeReader(Bitmap image, Rect[] areas, BaseDecodeType type)
Initializes a new instance of the BarCodeReader
class.
This sample shows how to detect Code39 and Code128 barcodes.Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight()), new MultyDecodeType(DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }
image
- The image.areas
- The areas for recognition.type
- The decode type.public BarCodeReader(Bitmap image, Rect area, BaseDecodeType type)
public static ProcessorSettings getProcessorSettings()
Gets a settings of using processor cores.
This sample shows how to use ProcessorSettings to add maximum multi-threaded performnce//this allows to use all cores for single BarCodeReader call BarCodeReader.getProcessorSettings().setUseAllCores(true); //this allows to use current count of cores BarCodeReader.getProcessorSettings().setUseAllCores(false); BarCodeReader.getProcessorSettings().setUseOnlyThisCoresCount(Math.max(1, Environment.getProcessorCount() / 2));
public int getTimeout()
Gets the timeout of recognition process in milliseconds.
BarCodeReader reader = new BarCodeReader("test.png"); reader.setTimeout(5000); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText());
public void setTimeout(int value)
Sets the timeout of recognition process in milliseconds.
BarCodeReader reader = new BarCodeReader("test.png"); reader.setTimeout(5000); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText());
value
- The timeout.public ChecksumValidation getChecksumValidation()
Enable checksum validation during recognition for 1D barcodes.
Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible.
Checksum never used: Codabar
Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN
Checksum always used: Rest symbologies
Value: The checksum validation flag.This sample shows influence of ChecksumValidation on recognition quality and resultsBarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.EAN_13, "1234567890128"); generator.save("test.png"); BarCodeReader reader = new BarCodeReader("test.png", DecodeType.EAN_13); //checksum disabled reader.setChecksumValidation(ChecksumValidation.OFF); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode CodeText: " + result.getCodeText()); System.out.println("BarCode Value: " + result.getExtended().getOneD().getValue()); System.out.println("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum()); } BarCodeReader reader = new BarCodeReader("test.png", DecodeType.EAN_13); //checksum enabled reader.setChecksumValidation(ChecksumValidation.ON); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode CodeText: " + result.getCodeText()); System.out.println("BarCode Value: " + result.getExtended().getOneD().getValue()); System.out.println("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum()); }
public void setChecksumValidation(ChecksumValidation value)
Enable checksum validation during recognition for 1D barcodes.
Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible.
Checksum never used: Codabar
Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN
Checksum always used: Rest symbologies
Value: The checksum validation flag.This sample shows influence of ChecksumValidation on recognition quality and resultsBarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.EAN_13, "1234567890128"); generator.save("test.png"); BarCodeReader reader = new BarCodeReader("test.png", DecodeType.EAN_13); //checksum disabled reader.setChecksumValidation(ChecksumValidation.OFF); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode CodeText: " + result.getCodeText()); System.out.println("BarCode Value: " + result.getExtended().getOneD().getValue()); System.out.println("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum()); } BarCodeReader reader = new BarCodeReader("test.png", DecodeType.EAN_13); //checksum enabled reader.setChecksumValidation(ChecksumValidation.ON); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode CodeText: " + result.getCodeText()); System.out.println("BarCode Value: " + result.getExtended().getOneD().getValue()); System.out.println("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum()); }
@Deprecated public void setChecksumValidation(int value)
value
- The checksum validation flag.public boolean getStripFNC()
Strip FNC1, FNC2, FNC3 characters from codetext. Default value is false.
This sample shows how to strip FNC charactersBarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.GS1Code128, "(02)04006664241007(37)1(400)7019590754")) generator.save("test.png"); BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_128); //StripFNC disabled reader.setStripFNC(false); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode CodeText: " + result.getCodeText()); } BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_128); //StripFNC enabled reader.setStripFNC(true); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode CodeText: " + result.getCodeText()); }
public void setStripFNC(boolean value)
Strip FNC1, FNC2, FNC3 characters from codetext. Default value is false.
This sample shows how to strip FNC charactersBarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.GS1Code128, "(02)04006664241007(37)1(400)7019590754"); generator.save("test.png"); BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_128); //StripFNC disabled reader.setStripFNC(false); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode CodeText: " + result.getCodeText()); } BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_128); //StripFNC enabled reader.setStripFNC(true); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode CodeText: " + result.getCodeText()); }
public CustomerInformationInterpretingType getCustomerInformationInterpretingType()
Gets the Interpreting Type for the Customer Information of AustralianPost BarCode.Default is CustomerInformationInterpretingType.OTHER.
public void setCustomerInformationInterpretingType(CustomerInformationInterpretingType value)
Sets the Interpreting Type for the Customer Information of AustralianPost BarCode.Default is CustomerInformationInterpretingType.OTHER.
public void setCustomerInformationInterpretingType(int value)
Sets the Interpreting Type for the Customer Information of AustralianPost BarCode.Default is CustomerInformationInterpretingType.OTHER.
@Deprecated public void close()
Closes barcode reader.
public void abort()
Function requests termination of current recognition session from other thread. Abort is unblockable method and returns control just after calling. The method should be used when recognition process is too long.
This sample shows how to call Abort function from other threadfinal BarCodeReader reader = new BarCodeReader("c:\\test.png", DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); Thread thread1 = new Thread(new Runnable() {
@Deprecated public boolean read()
Reads barcode from the image.
Detect AllSupportedTypesBarCodeReader reader; reader = new BarCodeReader("test.png"); while(reader.read()) { System.out.println("BarCode Type: "+reader.getReadType()); System.out.println("BarCode CodeText: " + reader.getCodeText()); } reader.close();
public BarCodeResult[] getFoundBarCodes()
Gets recognized BarCodeResult
s array
Value: The recognizedThis sample shows how to read barcodes with BarCodeReaderBarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); { reader.readBarCodes(); for(int i = 0; reader.getFoundCount() > i; ++i) System.out.println("BarCode CodeText: " + reader.getFoundBarCodes()[i].getCodeText()); }
BarCodeResult
s arraypublic int getFoundCount()
Gets recognized barcodes count
Value: The recognized barcodes countThis sample shows how to read barcodes with BarCodeReaderBarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); reader.readBarCodes(); for(int i = 0; reader.getFoundCount() > i; ++i) System.out.println("BarCode CodeText: " + reader.getFoundBarCodes()[i].getCodeText());
public BarCodeResult[] readBarCodes()
Reads BarCodeResult
s from the image.
This sample shows how to read barcodes with BarCodeReaderBarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); reader.readBarCodes(); for(int i = 0; reader.getFoundCount() > i; ++i) System.out.println("BarCode CodeText: " + reader.getFoundBarCodes()[i].getCodeText());
BarCodeResult
s on the image. If nothing is recognized, zero array is returned.public final QualitySettings getQualitySettings()
QualitySettings allows to configure recognition quality and speed manually. You can quickly set up QualitySettings by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of QualitySettings is NormalQuality.
Value: QualitySettings to configure recognition quality and speed.This sample shows how to use QualitySettings with BarCodeReaderBarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); //set high performance mode reader.setQualitySettings(QualitySettings.getHighPerformance()); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); //normal quality mode is set by default for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); //set high performance mode reader.setQualitySettings(QualitySettings.getHighPerformance()); //set separate options reader.getQualitySettings().setAllowMedianSmoothing(true); reader.getQualitySettings().setMedianSmoothingWindowSize(5); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText());
public final void setQualitySettings(QualitySettings value)
QualitySettings allows to configure recognition quality and speed manually. You can quickly set up QualitySettings by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of QualitySettings is NormalQuality.
Value: QualitySettings to configure recognition quality and speed.This sample shows how to use QualitySettings with BarCodeReaderBarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); //set high performance mode reader.setQualitySettings(QualitySettings.getHighPerformance()); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); //normal quality mode is set by default for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); //set high performance mode reader.setQualitySettings(QualitySettings.getHighPerformance()); //set separate options reader.getQualitySettings().setAllowMedianSmoothing(true); reader.getQualitySettings().setMedianSmoothingWindowSize(5); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText());
@Deprecated public java.lang.String getCodeText()
Gets the code text. Text will not contain the checksum for 1D barcode types, which support the checksum. Please use GetCodeText(true) method to get result with checksum.
@Deprecated public java.lang.String getCodeText(java.nio.charset.Charset encoding)
Gets the code text with encoding.
encoding
- The encoding for codetext.@Deprecated public java.lang.String getCodeText(boolean includeCheckSum)
includeCheckSum
- true to include CheckSum into result; false to return only CodeText.@Deprecated public java.lang.String getCheckSum()
Gets the checksum for 1D barcodes.
@Deprecated public float getAngle()
Gets the angle of the barcode (0-360).
@Deprecated public byte[] getCodeBytes()
Gets the encoded code bytes.
@Deprecated public java.lang.String getMacroPdf417FileID()
Gets the file ID of the barcode, only available with MacroPdf417.
@Deprecated public int getMacroPdf417SegmentID()
Gets the segment ID of the barcode,only available with MacroPdf417.
@Deprecated public int getMacroPdf417SegmentsCount()
Gets macro pdf417 barcode segments count. Default value is -1.
@Deprecated public Code128DataPortion[] getCode128DataPortions()
Code128DataPortion
objects.@Deprecated public int getQRStructuredAppendModeBarCodesQuantity()
Gets the QR structured append mode barcodes quantity. Default value is -1.
@Deprecated public int getQRStructuredAppendModeBarCodeIndex()
Gets the index of the QR structured append mode barcode. Index starts from 0. DEFAULT value is -1.
@Deprecated public int getQRStructuredAppendModeParityData()
Gets the QR structured append mode parity data. Default value is -1.
@Deprecated public boolean getIsDeniable()
Checks the deniable recognition. Such recognition might occur in QualitySettings.MAX_BARCODES mode decoding or use QualitySettings.ALLOW_INCORRECT_BARCODES
@Deprecated public BarCodeRegion getRegion()
Gets the barcode region.
@Deprecated public SingleDecodeType getCodeType()
Gets the barcode type.
@Deprecated public java.lang.String getCodeTypeName()
Gets the name of the barcode type.
@Deprecated public float getRecognitionQuality()
Gets the recognition quality. Works for 1D and postal barcodes.
@Deprecated public boolean getDetectEncoding()
A flag which force engine to detect codetext encoding for Unicode codesets.
This sample shows how to detect text encoding on the fly if DetectEncoding is enabledByteArrayOutputStream ms = new ByteArrayOutputStream(); BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR, "пїЅпїЅпїЅпїЅпїЅ")) generator.getParameters().getBarcode().getQR().setCodeTextEncoding(Charset.forName("UTF-8"); generator.save(ms, BarCodeImageFormat.getPng()); //detects encoding for Unicode codesets is enabled BarCodeReader reader = new BarCodeReader(new ByteArrayInputStream(ms.toByteArray()), DecodeType.QR); reader.setDetectEncoding(true); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); //detect encoding is disabled BarCodeReader reader = new BarCodeReader(new ByteArrayInputStream(ms.toByteArray()), DecodeType.QR); reader.setDetectEncoding(false); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText());
@Deprecated public void setDetectEncoding(boolean value)
A flag which force engine to detect codetext encoding for Unicode codesets.
This sample shows how to detect text encoding on the fly if DetectEncoding is enabledByteArrayOutputStream ms = new ByteArrayOutputStream(); BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR, "пїЅпїЅпїЅпїЅпїЅ"); generator.getParameters().getBarcode().getQR().setCodeTextEncoding(Charset.forName("UTF-8"); generator.save(ms, BarCodeImageFormat.getPng()); //detects encoding for Unicode codesets is enabled BarCodeReader reader = new BarCodeReader(new ByteArrayInputStream(ms.toByteArray()), DecodeType.QR); reader.setDetectEncoding(true); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); //detect encoding is disabled BarCodeReader reader = new BarCodeReader(new ByteArrayInputStream(ms.toByteArray()), DecodeType.QR); reader.setDetectEncoding(true); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText());
public final void setBarCodeImage(Bitmap value, Rect[] areas)
Sets bitmap image and areas for recognition. Must be called before ReadBarCodes() method.
This sample shows how to detect Code39 and Code128 barcodes.Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader(); reader.setBarCodeReadType(DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); reader.setBarCodeImage(bmp, new Rectangle[] { new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight()) }); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }
value
- The bitmap image for recognition.areas
- areas list for recognitionpublic final void setBarCodeImage(Bitmap value, Rect area)
Sets bitmap image and area for recognition. Must be called before ReadBarCodes() method.
This sample shows how to detect Code39 and Code128 barcodes.Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader(); reader.setBarCodeReadType(DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); reader.setBarCodeImage(bmp, new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight())); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }
value
- The bitmap image for recognition.area
- area for recognitionpublic final void setBarCodeImage(java.io.InputStream stream)
Sets image stream for recognition. Must be called before ReadBarCodes() method.
This sample shows how to detect Code39 and Code128 barcodes.InputStream fstr = new FileInputStream(new File("test.png")); BarCodeReader reader = new BarCodeReader(); reader.setBarCodeReadType(DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); reader.setBarCodeImage(fstr); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }
stream
- The image stream for recogniton.public void setBarCodeImage(Bitmap value)
Sets bitmap image for recognition. Must be called before ReadBarCodes() method.
This sample shows how to detect Code39 and Code128 barcodes.Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader()) { reader.setBarCodeReadType(DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); reader.setBarCodeImage(bmp); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); } }
value
- The bitmap image for recognition.public void setBarCodeReadType(SingleDecodeType... barcodeTypes)
Sets SingleDecodeType
type array for recognition.
Must be called before ReadBarCodes() method.
This sample shows how to detect Code39 and Code128 barcodes.BarCodeReader reader = new BarCodeReader(); reader.setBarCodeReadType(DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); reader.setBarCodeImage("test.png"); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }
barcodeTypes
- The SingleDecodeType
type array to read.public void setBarCodeReadType(BaseDecodeType type)
Sets decode type for recognition. Must be called before ReadBarCodes() method.
This sample shows how to detect Code39 and Code128 barcodes.BarCodeReader reader = new BarCodeReader()) reader.setBarCodeReadType(new MultyDecodeType(DecodeType.CODE_39_STANDARD, DecodeType.CODE_128); reader.setBarCodeImage("test.png"); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }
type
- The type of barcode to read.public void dispose()
public BaseDecodeType getBarCodeDecodeType()