public class BarCodeReader extends Object implements com.aspose.ms.System.IDisposable
BarCodeReader encapsulates an image which may contain one or several barcodes, it then can perform Read operation to detect barcodes
Detect an code39 barcode with supplement[Java] BarCodeReader reader; reader = new BarCodeReader("c:\\test.jpg"); while(reader.read()) { System.out.println("BarCode Type: " + reader.getReadType()); System.out.println("BarCode CodeText: " + reader.getCodeText()); } reader.close();
Modifier and Type | Class and Description |
---|---|
static class |
BarCodeReader.PossibleBarCode
Describes possible barcode found.
|
Constructor and Description |
---|
BarCodeReader()
Initializes a new instance of the
BarCodeReader class with default values. |
BarCodeReader(BufferedImage image) |
BarCodeReader(BufferedImage image,
long type) |
BarCodeReader(BufferedImage image,
Rectangle area,
long type) |
BarCodeReader(InputStream stream) |
BarCodeReader(InputStream stream,
long type) |
BarCodeReader(String filename)
Initializes a new instance of the
BarCodeReader class from file. |
BarCodeReader(String filename,
long type)
Initializes a new instance of the
BarCodeReader class. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes barcode reader.
|
void |
dispose() |
BarCodeReader.PossibleBarCode[] |
getAllPossibleBarCodes()
Gets all possible barcodes found.
|
float |
getAngle()
Gets the angle of the barcode (0-360).
|
String |
getCheckSum()
Gets the checksum for 1D barcodes.
|
int |
getChecksumValidation() |
byte[] |
getCodeBytes()
Gets the encoded code bytes.
|
String |
getCodeText()
Gets the code text.
|
String |
getCodeText(Charset encoding) |
int |
getCustomerInformationInterpretingType()
Gets or sets the Interpreting Type for the Customer Information of AustralianPost BarCode.Default is CustomerInformationInterpretingType.Other.
|
int |
getExpectedBarCodeCount()
Expected barcodes to be found.The reader will stop reading the image once it found barcodes more than this value.
|
int |
getImageBinarizationHints()
Gets or sets the image binarization hints.
|
int |
getMacroPdf417FileID()
Gets the file ID of the barcode, only available with MacroPdf417.
|
int |
getMacroPdf417SegmentID()
Gets the segment ID of the barcode,only available with MacroPdf417.
|
int |
getMacroPdf417SegmentsCount()
Gets macro pdf417 barcode segments count.
|
int |
getMedianSmoothingWindowSize()
Gets or sets the median smoothing window size.
|
int |
getOrientationHints()
Gets or sets the orientation hints.
|
int |
getQRStructuredAppendModeBarCodeIndex()
Gets the index of the QR structured append mode barcode.
|
int |
getQRStructuredAppendModeBarCodesQuantity()
Gets the QR structured append mode barcodes quantity.
|
int |
getQRStructuredAppendModeParityData()
Gets the QR structured append mode parity data.
|
long |
getReadType()
Gets the barcode type.
|
float |
getRecognitionQuality()
Gets the recognition quality.
|
BarCodeRegion |
getRegion()
Gets the barcode region.
|
boolean |
getStripFNC()
Strip FNC1, FNC2, FNC3 characters from codetext.
|
int |
getTimeout()
Gets or sets the timeout of recognition process.
|
static boolean |
isLicensed()
Gets a value indicating whether recognition module is licensed.
|
boolean |
read()
Reads barcode from the image.
|
void |
setBarCodeImage(BufferedImage value) |
void |
setBarCodeImage(String filename)
Sets image file for recogniton.
|
void |
setBarCodeReadType(long type)
Sets BarCodeReadType for recognition.
|
void |
setChecksumValidation(int value) |
void |
setCustomerInformationInterpretingType(int value) |
void |
setExpectedBarCodeCount(int value) |
void |
setImageBinarizationHints(int value) |
void |
setMedianSmoothingWindowSize(int value) |
void |
setOrientationHints(int value) |
void |
setStripFNC(boolean value) |
void |
setTimeout(int value) |
public BarCodeReader()
Initializes a new instance of the BarCodeReader
class with default values.
Requires to set image (SetBitmapImage()) before to call Read() method.
public BarCodeReader(BufferedImage image)
public BarCodeReader(BufferedImage image, long type)
public BarCodeReader(BufferedImage image, Rectangle area, long type)
public BarCodeReader(String filename)
Initializes a new instance of the BarCodeReader
class from file.
filename
- The filename.public BarCodeReader(String filename, long type)
Initializes a new instance of the BarCodeReader
class.
filename
- The filename.type
- The BarCodeReadType.public BarCodeReader(InputStream stream)
public BarCodeReader(InputStream stream, long type)
public static boolean isLicensed()
Gets a value indicating whether recognition module is licensed.
Value:true
if recognition module is licensed; otherwise, false
.public int getTimeout()
Gets or sets the timeout of recognition process.
Value: The timeout.public void setTimeout(int value)
public int 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.public void setChecksumValidation(int value)
public int getMedianSmoothingWindowSize()
Gets or sets the median smoothing window size. Typical values are 3 or 4. Default value is 3. Recognition hint MedianSmoothing must be set.
Value: The median smoothing window size. Typical values are 3 or 4. Default value is 3.public void setMedianSmoothingWindowSize(int value)
public int getExpectedBarCodeCount()
Expected barcodes to be found.The reader will stop reading the image once it found barcodes more than this value. Default value is int.MaxValue.
public void setExpectedBarCodeCount(int value)
public boolean getStripFNC()
Strip FNC1, FNC2, FNC3 characters from codetext. Default value is false.
public void setStripFNC(boolean value)
public int getCustomerInformationInterpretingType()
Gets or sets the Interpreting Type for the Customer Information of AustralianPost BarCode.Default is CustomerInformationInterpretingType.Other.
public void setCustomerInformationInterpretingType(int value)
public void close()
Closes barcode reader.
public boolean read()
Reads barcode from the image.
Detect AllSupportedTypes[Java] BarCodeReader reader; reader = new BarCodeReader("c:\\test.jpg"); while(reader.read()) { System.out.println("BarCode Type: " + reader.getReadType()); System.out.println("BarCode CodeText: " + reader.getCodeText()); } reader.close();
public int getOrientationHints()
Gets or sets the orientation hints.
Value: The orientation hints. Default value is NoRotate.public void setOrientationHints(int value)
public int getImageBinarizationHints()
Gets or sets the image binarization hints.
Value: The image binarization hints. Default value is None.public void setImageBinarizationHints(int value)
public String getCodeText()
Gets the code text.
public String getCheckSum()
Gets the checksum for 1D barcodes.
public float getAngle()
Gets the angle of the barcode (0-360). RecognitionHints.Orientation enum does not included into the calculation.
public byte[] getCodeBytes()
Gets the encoded code bytes.
public int getMacroPdf417FileID()
Gets the file ID of the barcode, only available with MacroPdf417.
public int getMacroPdf417SegmentID()
Gets the segment ID of the barcode,only available with MacroPdf417.
public int getMacroPdf417SegmentsCount()
Gets macro pdf417 barcode segments count. Default value is -1.
public int getQRStructuredAppendModeBarCodesQuantity()
Gets the QR structured append mode barcodes quantity. Default value is -1.
public int getQRStructuredAppendModeBarCodeIndex()
Gets the index of the QR structured append mode barcode. Index starts from 0. Default value is -1.
public int getQRStructuredAppendModeParityData()
Gets the QR structured append mode parity data. Default value is -1.
public BarCodeRegion getRegion()
Gets the barcode region.
public long getReadType()
Gets the barcode type.
public float getRecognitionQuality()
Gets the recognition quality. Works for 1D and postal barcodes.
public BarCodeReader.PossibleBarCode[] getAllPossibleBarCodes()
Gets all possible barcodes found. Only for 1D barcodes. Includes correct answer if the barcode recognized fine.
public void setBarCodeImage(BufferedImage value)
public void setBarCodeImage(String filename)
Sets image file for recogniton. Must be called before Read() method.
filename
- The image file for recogniton.public void setBarCodeReadType(long type)
Sets BarCodeReadType for recognition. Must be called before Read() method.
type
- The type of barcode to read.public void dispose()
dispose
in interface com.aspose.ms.System.IDisposable
Copyright (c) 2002-2014 Aspose Pty Ltd. All Rights Reserved.