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

Constructors

ConstructorDescription
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

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

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

BarCodeReader(Bitmap image)

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

Parameters:

ParameterTypeDescription
imageandroid.graphics.BitmapA Bitmap instance containing the image

BarCodeReader(Bitmap image, BaseDecodeType[] decodeTypes)

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

Parameters:

ParameterTypeDescription
imageandroid.graphics.BitmapThe image.
decodeTypesBaseDecodeType[]Decode types.

BarCodeReader(Bitmap image, BaseDecodeType type)

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

Parameters:

ParameterTypeDescription
imageandroid.graphics.BitmapThe image.
typeBaseDecodeTypeThe decode type1. It can be single or multy

BarCodeReader(Bitmap image, Rect area, BaseDecodeType[] decodeTypes)

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

Parameters:

ParameterTypeDescription
imageandroid.graphics.BitmapThe image.
areaandroid.graphics.RectThe area for recognition.
decodeTypesBaseDecodeType[]Decode types.

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

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

Parameters:

ParameterTypeDescription
imagePathjava.lang.StringThe image path.
areasandroid.graphics.Rect[]The area for recognition.
typeBaseDecodeTypeThe decode type.

BarCodeReader(InputStream stream, Rect area, BaseDecodeType type)

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

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe image stream.
areaandroid.graphics.RectThe area for recognition.
typeBaseDecodeTypeThe decode type.

BarCodeReader(String imagePath, Rect area, BaseDecodeType type)

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

Parameters:

ParameterTypeDescription
imagePathjava.lang.StringThe image path.
areaandroid.graphics.RectThe area for recognition.
typeBaseDecodeTypeThe decode type.

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

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

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe image stream.
areasandroid.graphics.Rect[]The area for recognition.
typeBaseDecodeTypeThe decode type.

BarCodeReader(Bitmap image, Rect[] areas, BaseDecodeType type)

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

Parameters:

ParameterTypeDescription
imageandroid.graphics.BitmapThe image.
areasandroid.graphics.Rect[]The areas for recognition.
typeBaseDecodeTypeThe decode type.

BarCodeReader(Bitmap image, Rect area, BaseDecodeType type)

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

Parameters:

ParameterTypeDescription
imageandroid.graphics.Bitmap
areaandroid.graphics.Rect
typeBaseDecodeType

BarCodeReader(String filename)

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

Parameters:

ParameterTypeDescription
filenamejava.lang.StringThe filename.

BarCodeReader(String filename, BaseDecodeType type)

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

Parameters:

ParameterTypeDescription
filenamejava.lang.StringThe filename.
typeBaseDecodeTypeThe decode type.

BarCodeReader(String filename, BaseDecodeType[] decodeTypes)

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

Parameters:

ParameterTypeDescription
filenamejava.lang.StringThe filename.
decodeTypesBaseDecodeType[]Decode types.

BarCodeReader(InputStream stream)

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

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe stream.

BarCodeReader(InputStream stream, BaseDecodeType type)

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

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe stream.
typeBaseDecodeTypeThe decode type.

BarCodeReader(InputStream stream, BaseDecodeType[] decodeTypes)

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

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe stream.
decodeTypesBaseDecodeType[]Decode types.

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_STANDARD, DecodeType.CODE_128);
  Thread thread1 = new Thread(new Runnable()
  {

dispose()

public void dispose()

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

exportToXml(OutputStream xmlStream)

public boolean exportToXml(OutputStream xmlStream)

Exports BarCode properties to the xml-stream specified

Parameters:

ParameterTypeDescription
xmlStreamjava.io.OutputStreamThe xml-stream for saving

Returns: boolean - Whether or not export completed successfully.

Returns True in case of success; False Otherwise

exportToXml(String xmlFile)

public boolean exportToXml(String xmlFile)

Exports BarCode properties to the xml-file specified

Parameters:

ParameterTypeDescription
xmlFilejava.lang.StringThe name of the file

Returns: boolean - Whether or not export completed successfully.

Returns True in case of success; False Otherwise

getBarCodeDecodeType()

public BaseDecodeType getBarCodeDecodeType()

Gets the decode type of the input barcode decoding

Returns: BaseDecodeType

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

public final native Class<?> getClass()

Returns: java.lang.Class

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_STANDARD, 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()

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_STANDARD, 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()

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

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

Value: QualitySettings to configure recognition quality and speed.

Returns: QualitySettings

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

public native int hashCode()

Returns: int

importFromXml(InputStream xmlStream)

public static BarCodeReader importFromXml(InputStream xmlStream)

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

Parameters:

ParameterTypeDescription
xmlStreamjava.io.InputStreamThe xml-stream for loading

Returns: BarCodeReader - Returns True in case of success;

False Otherwise

importFromXml(String xmlFile)

public static BarCodeReader importFromXml(String xmlFile)

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

Parameters:

ParameterTypeDescription
xmlFilejava.lang.StringThe name of the file

Returns: BarCodeReader - Returns True in case of success;

False Otherwise

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

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

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)

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

Parameters:

ParameterTypeDescription
valueandroid.graphics.BitmapThe bitmap image for recognition.

setBarCodeImage(Bitmap value, Rect area)

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

Parameters:

ParameterTypeDescription
valueandroid.graphics.BitmapThe bitmap image for recognition.
areaandroid.graphics.Rectarea for recognition

setBarCodeImage(Bitmap value, Rect[] areas)

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

Parameters:

ParameterTypeDescription
valueandroid.graphics.BitmapThe bitmap image for recognition.
areasandroid.graphics.Rect[]areas list for recognition

setBarCodeImage(InputStream stream)

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

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe image stream for recogniton.

setBarCodeImage(String filename)

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

Parameters:

ParameterTypeDescription
filenamejava.lang.StringThe image file for recogniton.

setBarCodeReadType(BaseDecodeType type)

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

Parameters:

ParameterTypeDescription
typeBaseDecodeTypeThe type of barcode to read.

setBarCodeReadType(SingleDecodeType[] barcodeTypes)

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

Parameters:

ParameterTypeDescription
barcodeTypesSingleDecodeType[]The SingleDecodeType type array to read.

setQualitySettings(QualitySettings value)

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

Value: QualitySettings to configure recognition quality and speed.

Parameters:

ParameterTypeDescription
valueQualitySettings

setTimeout(int value)

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:

ParameterTypeDescription
valueintThe timeout.

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int