Skip to content

Latest commit

 

History

History
1170 lines (907 loc) · 41.2 KB

File metadata and controls

1170 lines (907 loc) · 41.2 KB
title BarCodeReader
second_title Aspose.BarCode for Android via Java API Reference
description BarCodeReader encapsulates an image which may contain one or several barcodes it then can perform ReadBarCodes operation to detect barcodes.
type docs
weight 15
url /androidjava/com.aspose.barcode.barcoderecognition/barcodereader/

Inheritance: java.lang.Object

public class BarCodeReader

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, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
    System.out.println("BarCode Type: " + result.getCodeTypeName());
    System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Constructors

Constructor 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 area, BaseDecodeType[] decodeTypes) Initializes a new instance of the BarCodeReader class.
BarCodeReader(String imagePath, Rect[] areas, BaseDecodeType type) Initializes a new instance of the BarCodeReader class.
BarCodeReader(InputStream stream, Rect area, BaseDecodeType type) Initializes a new instance of the BarCodeReader class.
BarCodeReader(String imagePath, Rect area, BaseDecodeType type) Initializes a new instance of the BarCodeReader class.
BarCodeReader(InputStream stream, Rect[] areas, 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 type)
BarCodeReader(String filename) Initializes a new instance of the BarCodeReader class from file.
BarCodeReader(String filename, BaseDecodeType type) Initializes a new instance of the BarCodeReader class.
BarCodeReader(String filename, BaseDecodeType[] decodeTypes) Initializes a new instance of the BarCodeReader class.
BarCodeReader(InputStream stream) Initializes a new instance of the BarCodeReader class.
BarCodeReader(InputStream stream, BaseDecodeType type) Initializes a new instance of the BarCodeReader class.
BarCodeReader(InputStream stream, BaseDecodeType[] decodeTypes) Initializes a new instance of the BarCodeReader class.

Methods

Method Description
abort() Function requests termination of current recognition session from other thread.
dispose()
equals(Object arg0)
exportToXml(OutputStream xmlStream) Exports BarCode properties to the xml-stream specified
exportToXml(String xmlFile) Exports BarCode properties to the xml-file specified
getBarCodeDecodeType() Gets the decode type of the input barcode decoding
getBarcodeSettings() The main BarCode decoding parameters.
getClass()
getFoundBarCodes() Gets recognized BarCodeResult s array
getFoundCount() Gets recognized barcodes count
getProcessorSettings() Gets a settings of using processor cores.
getQualitySettings() QualitySettings allows to configure recognition quality and speed manually.
getTimeout() Gets the timeout of recognition process in milliseconds.
hashCode()
importFromXml(InputStream xmlStream) Imports BarCode properties from the xml-stream specified and applies them to the current BarCodeReader instance.
importFromXml(String xmlFile) Imports BarCode properties from the xml-file specified and applies them to the current BarCodeReader instance.
notify()
notifyAll()
readBarCodes() Reads BarCodeResult s from the image.
setBarCodeImage(Bitmap value) Sets bitmap image for recognition.
setBarCodeImage(Bitmap value, Rect area) Sets bitmap image and area for recognition.
setBarCodeImage(Bitmap value, Rect[] areas) Sets bitmap image and areas for recognition.
setBarCodeImage(InputStream stream) Sets image stream for recognition.
setBarCodeImage(String filename) Sets image file for recognition.
setBarCodeReadType(BaseDecodeType type) Sets decode type for recognition.
setBarCodeReadType(SingleDecodeType[] barcodeTypes) Sets SingleDecodeType type array for recognition.
setQualitySettings(QualitySettings value) QualitySettings allows to configure recognition quality and speed manually.
setTimeout(int value) Sets the timeout of recognition process in milliseconds.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

BarCodeReader() {#BarCodeReader--}

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, 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());
 }

BarCodeReader(Bitmap image) {#BarCodeReader-android.graphics.Bitmap-}

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, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
     System.out.println("BarCode Type: " + result.getCodeTypeName());
     System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
image android.graphics.Bitmap A Bitmap instance containing the image

BarCodeReader(Bitmap image, BaseDecodeType[] decodeTypes) {#BarCodeReader-android.graphics.Bitmap-com.aspose.barcode.barcoderecognition.BaseDecodeType...-}

public 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, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
    System.out.println("BarCode Type: " + result.getCodeTypeName());
    System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
image android.graphics.Bitmap The image.
decodeTypes BaseDecodeType[] Decode types.

BarCodeReader(Bitmap image, BaseDecodeType type) {#BarCodeReader-android.graphics.Bitmap-com.aspose.barcode.barcoderecognition.BaseDecodeType-}

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, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
     System.out.println("BarCode Type: " + result.getCodeTypeName());
     System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
image android.graphics.Bitmap The image.
type BaseDecodeType The decode type1. It can be single or multy

BarCodeReader(Bitmap image, Rect area, BaseDecodeType[] decodeTypes) {#BarCodeReader-android.graphics.Bitmap-android.graphics.Rect-com.aspose.barcode.barcoderecognition.BaseDecodeType...-}

public 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, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
     System.out.println("BarCode Type: " + result.getCodeTypeName());
     System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
image android.graphics.Bitmap The image.
area android.graphics.Rect The area for recognition.
decodeTypes BaseDecodeType[] Decode types.

BarCodeReader(String imagePath, Rect[] areas, BaseDecodeType type) {#BarCodeReader-java.lang.String-android.graphics.Rect---com.aspose.barcode.barcoderecognition.BaseDecodeType-}

public BarCodeReader(String imagePath, Rect[] areas, BaseDecodeType type)

Initializes a new instance of the BarCodeReader class.


This sample shows how to detect Code39 and Code128 barcodes.
 
 BufferedImage bmp = ImageIO.read(new File("c:\\test.png"));
 BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight()), new MultyDecodeType(DecodeType.CODE_39, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
    System.out.println("BarCode Type: " + result.getCodeTypeName());
    System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
imagePath java.lang.String The image path.
areas android.graphics.Rect[] The area for recognition.
type BaseDecodeType The decode type.

BarCodeReader(InputStream stream, Rect area, BaseDecodeType type) {#BarCodeReader-java.io.InputStream-android.graphics.Rect-com.aspose.barcode.barcoderecognition.BaseDecodeType-}

public BarCodeReader(InputStream stream, Rect area, BaseDecodeType type)

Initializes a new instance of the BarCodeReader class.


This sample shows how to detect Code39 and Code128 barcodes.
 
 BufferedImage bmp = ImageIO.read(new File("c:\\test.png"));
 BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight()), new MultyDecodeType(DecodeType.CODE_39, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
    System.out.println("BarCode Type: " + result.getCodeTypeName());
    System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
stream java.io.InputStream The image stream.
area android.graphics.Rect The area for recognition.
type BaseDecodeType The decode type.

BarCodeReader(String imagePath, Rect area, BaseDecodeType type) {#BarCodeReader-java.lang.String-android.graphics.Rect-com.aspose.barcode.barcoderecognition.BaseDecodeType-}

public BarCodeReader(String imagePath, Rect area, BaseDecodeType type)

Initializes a new instance of the BarCodeReader class.


This sample shows how to detect Code39 and Code128 barcodes.
 
 BufferedImage bmp = ImageIO.read(new File("c:\\test.png"));
 BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight()), new MultyDecodeType(DecodeType.CODE_39, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
    System.out.println("BarCode Type: " + result.getCodeTypeName());
    System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
imagePath java.lang.String The image path.
area android.graphics.Rect The area for recognition.
type BaseDecodeType The decode type.

BarCodeReader(InputStream stream, Rect[] areas, BaseDecodeType type) {#BarCodeReader-java.io.InputStream-android.graphics.Rect---com.aspose.barcode.barcoderecognition.BaseDecodeType-}

public BarCodeReader(InputStream stream, Rect[] areas, BaseDecodeType type)

Initializes a new instance of the BarCodeReader class.


This sample shows how to detect Code39 and Code128 barcodes.
 
 BufferedImage bmp = ImageIO.read(new File("c:\\test.png"));
 BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight()), new MultyDecodeType(DecodeType.CODE_39, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
    System.out.println("BarCode Type: " + result.getCodeTypeName());
    System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
stream java.io.InputStream The image stream.
areas android.graphics.Rect[] The area for recognition.
type BaseDecodeType The decode type.

BarCodeReader(Bitmap image, Rect[] areas, BaseDecodeType type) {#BarCodeReader-android.graphics.Bitmap-android.graphics.Rect---com.aspose.barcode.barcoderecognition.BaseDecodeType-}

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, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
    System.out.println("BarCode Type: " + result.getCodeTypeName());
    System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
image android.graphics.Bitmap The image.
areas android.graphics.Rect[] The areas for recognition.
type BaseDecodeType The decode type.

BarCodeReader(Bitmap image, Rect area, BaseDecodeType type) {#BarCodeReader-android.graphics.Bitmap-android.graphics.Rect-com.aspose.barcode.barcoderecognition.BaseDecodeType-}

public BarCodeReader(Bitmap image, Rect area, BaseDecodeType type)

Parameters:

Parameter Type Description
image android.graphics.Bitmap
area android.graphics.Rect
type BaseDecodeType

BarCodeReader(String filename) {#BarCodeReader-java.lang.String-}

public BarCodeReader(String filename)

Initializes a new instance of the BarCodeReader class from file.


This sample shows how to detect Code39 and Code128 barcodes.
 
 BarCodeReader reader = new BarCodeReader("test.png");
 reader.setBarCodeReadType(DecodeType.CODE_39, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
     System.out.println("BarCode Type: " + result.getCodeTypeName());
     System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
filename java.lang.String The filename.

BarCodeReader(String filename, BaseDecodeType type) {#BarCodeReader-java.lang.String-com.aspose.barcode.barcoderecognition.BaseDecodeType-}

public BarCodeReader(String filename, BaseDecodeType type)

Initializes a new instance of the BarCodeReader class.


This sample shows how to detect Code39 and Code128 barcodes.
 
 BarCodeReader reader = new BarCodeReader("test.png", new MultyDecodeType(DecodeType.CODE_39, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
     System.out.println("BarCode Type: " + result.getCodeTypeName());
     System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
filename java.lang.String The filename.
type BaseDecodeType The decode type.

BarCodeReader(String filename, BaseDecodeType[] decodeTypes) {#BarCodeReader-java.lang.String-com.aspose.barcode.barcoderecognition.BaseDecodeType...-}

public BarCodeReader(String filename, BaseDecodeType[] decodeTypes)

Initializes a new instance of the BarCodeReader class.


This sample shows how to detect Code39 and Code128 barcodes.
 
 BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
    System.out.println("BarCode Type: " + result.getCodeTypeName());
    System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
filename java.lang.String The filename.
decodeTypes BaseDecodeType[] Decode types.

BarCodeReader(InputStream stream) {#BarCodeReader-java.io.InputStream-}

public BarCodeReader(InputStream stream)

Initializes a new instance of the BarCodeReader class.


This sample shows how to detect Code39 and Code128 barcodes.
 
 InputStream fstr = new FileInputStream(new File("test.png"));
 BarCodeReader reader = new BarCodeReader(fstr);
 reader.setBarCodeReadType(DecodeType.CODE_39, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
     System.out.println("BarCode Type: " + result.getCodeTypeName());
     System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
stream java.io.InputStream The stream.

BarCodeReader(InputStream stream, BaseDecodeType type) {#BarCodeReader-java.io.InputStream-com.aspose.barcode.barcoderecognition.BaseDecodeType-}

public BarCodeReader(InputStream stream, BaseDecodeType type)

Initializes a new instance of the BarCodeReader class.


This sample shows how to detect Code39 and Code128 barcodes.
 
 InputStream fstr = new FileInputStream("test.png");
 BarCodeReader reader = new BarCodeReader(fstr, new MultyDecodeType(DecodeType.CODE_39, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
     System.out.println("BarCode Type: " + result.getCodeTypeName());
     System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
stream java.io.InputStream The stream.
type BaseDecodeType The decode type.

BarCodeReader(InputStream stream, BaseDecodeType[] decodeTypes) {#BarCodeReader-java.io.InputStream-com.aspose.barcode.barcoderecognition.BaseDecodeType...-}

public BarCodeReader(InputStream stream, BaseDecodeType[] decodeTypes)

Initializes a new instance of the BarCodeReader class.


This sample shows how to detect Code39 and Code128 barcodes.
 
 InputStream fstr = new FileInputStream("test.png"));
 BarCodeReader reader = new BarCodeReader(fstr, DecodeType.CODE_39, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
 {
    System.out.println("BarCode Type: " + result.getCodeTypeName());
    System.out.println("BarCode CodeText: " + result.getCodeText());
 }

Parameters:

Parameter Type Description
stream java.io.InputStream The stream.
decodeTypes BaseDecodeType[] Decode types.

abort() {#abort--}

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 thread
 
  final BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128);
  Thread thread1 = new Thread(new Runnable()
  {

dispose() {#dispose--}

public void dispose()

equals(Object arg0) {#equals-java.lang.Object-}

public boolean equals(Object arg0)

Parameters:

Parameter Type Description
arg0 java.lang.Object

Returns: boolean

exportToXml(OutputStream xmlStream) {#exportToXml-java.io.OutputStream-}

public boolean exportToXml(OutputStream xmlStream)

Exports BarCode properties to the xml-stream specified

Parameters:

Parameter Type Description
xmlStream java.io.OutputStream The xml-stream for saving

Returns: boolean - Whether or not export completed successfully.

Returns True in case of success; False Otherwise

exportToXml(String xmlFile) {#exportToXml-java.lang.String-}

public boolean exportToXml(String xmlFile)

Exports BarCode properties to the xml-file specified

Parameters:

Parameter Type Description
xmlFile java.lang.String The name of the file

Returns: boolean - Whether or not export completed successfully.

Returns True in case of success; False Otherwise

getBarCodeDecodeType() {#getBarCodeDecodeType--}

public BaseDecodeType getBarCodeDecodeType()

Gets the decode type of the input barcode decoding

Returns: BaseDecodeType

getBarcodeSettings() {#getBarcodeSettings--}

public BarcodeSettings getBarcodeSettings()

The main BarCode decoding parameters. Contains parameters which make influence on recognized data.

Returns: BarcodeSettings - The main BarCode decoding parameters

getClass() {#getClass--}

public final native Class<?> getClass()

Returns: java.lang.Class<?>

getFoundBarCodes() {#getFoundBarCodes--}

public BarCodeResult[] getFoundBarCodes()

Gets recognized BarCodeResult s array


This sample shows how to read barcodes with BarCodeReader
 
 BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128);
 {
     reader.readBarCodes();
     for(int i = 0; reader.getFoundCount() > i; ++i)
         System.out.println("BarCode CodeText: " + reader.getFoundBarCodes()[i].getCodeText());
 }

Value: The recognized BarCodeResult s array

Returns: com.aspose.barcode.barcoderecognition.BarCodeResult[]

getFoundCount() {#getFoundCount--}

public int getFoundCount()

Gets recognized barcodes count


This sample shows how to read barcodes with BarCodeReader
 
 BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128);
 reader.readBarCodes();
 for(int i = 0; reader.getFoundCount() > i; ++i)
    System.out.println("BarCode CodeText: " + reader.getFoundBarCodes()[i].getCodeText());

Value: The recognized barcodes count

Returns: int

getProcessorSettings() {#getProcessorSettings--}

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));

Returns: ProcessorSettings

getQualitySettings() {#getQualitySettings--}

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.


This sample shows how to use QualitySettings with BarCodeReader
 
 BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, 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, 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, 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());

Value: QualitySettings to configure recognition quality and speed.

Returns: QualitySettings

getTimeout() {#getTimeout--}

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());

Returns: int - The timeout.

hashCode() {#hashCode--}

public native int hashCode()

Returns: int

importFromXml(InputStream xmlStream) {#importFromXml-java.io.InputStream-}

public static BarCodeReader importFromXml(InputStream xmlStream)

Imports BarCode properties from the xml-stream specified and applies them to the current BarCodeReader instance.

Parameters:

Parameter Type Description
xmlStream java.io.InputStream The xml-stream for loading

Returns: BarCodeReader - Returns True in case of success;

False Otherwise

importFromXml(String xmlFile) {#importFromXml-java.lang.String-}

public static BarCodeReader importFromXml(String xmlFile)

Imports BarCode properties from the xml-file specified and applies them to the current BarCodeReader instance.

Parameters:

Parameter Type Description
xmlFile java.lang.String The name of the file

Returns: BarCodeReader - Returns True in case of success;

False Otherwise

notify() {#notify--}

public final native void notify()

notifyAll() {#notifyAll--}

public final native void notifyAll()

readBarCodes() {#readBarCodes--}

public BarCodeResult[] readBarCodes()

Reads BarCodeResult s from the image.


This sample shows how to read barcodes with BarCodeReader
 
 BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128);
 for(BarCodeResult result : reader.readBarCodes())
    System.out.println("BarCode CodeText: " + result.getCodeText());
 BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128);
 reader.readBarCodes();
 for(int i = 0; reader.getFoundCount() > i; ++i)
    System.out.println("BarCode CodeText: " + reader.getFoundBarCodes()[i].getCodeText());

Returns: com.aspose.barcode.barcoderecognition.BarCodeResult[] - Returns array of recognized BarCodeResult s on the image. If nothing is recognized, zero array is returned.

setBarCodeImage(Bitmap value) {#setBarCodeImage-android.graphics.Bitmap-}

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, 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());
     }
 }

Parameters:

Parameter Type Description
value android.graphics.Bitmap The bitmap image for recognition.

setBarCodeImage(Bitmap value, Rect area) {#setBarCodeImage-android.graphics.Bitmap-android.graphics.Rect-}

public 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, 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());
 }

Parameters:

Parameter Type Description
value android.graphics.Bitmap The bitmap image for recognition.
area android.graphics.Rect area for recognition

setBarCodeImage(Bitmap value, Rect[] areas) {#setBarCodeImage-android.graphics.Bitmap-android.graphics.Rect---}

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, 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());
 }

Parameters:

Parameter Type Description
value android.graphics.Bitmap The bitmap image for recognition.
areas android.graphics.Rect[] areas list for recognition

setBarCodeImage(InputStream stream) {#setBarCodeImage-java.io.InputStream-}

public final void setBarCodeImage(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, 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());
 }

Parameters:

Parameter Type Description
stream java.io.InputStream The image stream for recogniton.

setBarCodeImage(String filename) {#setBarCodeImage-java.lang.String-}

public void setBarCodeImage(String filename)

Sets image file 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, 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());
     }
 }

Parameters:

Parameter Type Description
filename java.lang.String The image file for recogniton.

setBarCodeReadType(BaseDecodeType type) {#setBarCodeReadType-com.aspose.barcode.barcoderecognition.BaseDecodeType-}

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, 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());
 }

Parameters:

Parameter Type Description
type BaseDecodeType The type of barcode to read.

setBarCodeReadType(SingleDecodeType[] barcodeTypes) {#setBarCodeReadType-com.aspose.barcode.barcoderecognition.SingleDecodeType...-}

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, 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());
 }

Parameters:

Parameter Type Description
barcodeTypes SingleDecodeType[] The SingleDecodeType type array to read.

setQualitySettings(QualitySettings value) {#setQualitySettings-com.aspose.barcode.barcoderecognition.QualitySettings-}

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.


This sample shows how to use QualitySettings with BarCodeReader
 
 BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, 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, 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, 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());

Value: QualitySettings to configure recognition quality and speed.

Parameters:

Parameter Type Description
value QualitySettings

setTimeout(int value) {#setTimeout-int-}

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());

Parameters:

Parameter Type Description
value int The timeout.

toString() {#toString--}

public String toString()

Returns: java.lang.String

wait() {#wait--}

public final void wait()

wait(long arg0) {#wait-long-}

public final void wait(long arg0)

Parameters:

Parameter Type Description
arg0 long

wait(long arg0, int arg1) {#wait-long-int-}

public final void wait(long arg0, int arg1)

Parameters:

Parameter Type Description
arg0 long
arg1 int