Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Class BarCodeReader in Aspose.BarCode for Python via Java is the most important to implement barcode recognition for more than 60 symbologies. First, it is necessary to indentify a barcode source that can be represented as a file, a stream, or a bitmap object. After that, target symbologies needs to be specified using values from the DecodeType enum. By default, the library uses the DecodeType.ALL_SUPPORTED_TYPES setting that implies iterating over all supported barcode types to check for their presence in the source image. In this case, barcode scanning and recognition takes much more time. Developers can specify explicitly not only the desired symbologies but also a target region or regions in the source image. This allows optimizing the scanning process by avoiding areas without barcodes. Target regions can be determined using a system class called Rectangle.
In Aspose.BarCode for Python via Java, barcode reading is performed according to the following steps:
Aspose.BarCode for Python contains the ReadBarCodes method of class BarCodeReader that returns the result of barcode reading in an array of the BarCodeResult type.
To load barcode recognition outputs, it is needed to call the ReadBarCodes method that provides a BarCodeResult array. Moreover, the current recognition output can be accessed through the getFoundBarCodes method that enables fetching decoding results or the getFoundCount method that returns the number of detected barcodes.
In Aspose.BarCode for Python via Java, there are three ways to set the barcode recognition source: from an image file, from a bitmap, or from a stream. The following five raster image formats are supported: PNG, JPEG, BMP, TIFF, or GIF. Three options to set the source for barcodes reading are explained further.
First of all, barcodes can be scanned and recognized from image files. The full or relative path to the source needs to be specified in the BarCodeReader constructor. Alternatively, the setBarCodeImage method can be used to pass the path to the existing object of class BarCodeReader.
In Aspose.BarCode for Python via Java, it is possible to use a graphical object or a bitmap as a source for barcode reading. Bitmap objects allow working with images consisting of pixel data. To read barcodes from a bitmap, the created bitmap object needs to be passed to the BarCodeReader() constructor or the setBarCodeImage method.
In Aspose.BarCode for Python via Java, a stream (in a binary format) can be also used as a source for barcode recognition. This option can be useful in some situations owing to its versatility and accessibility without file systems. A stream to read barcodes from needs to be passed to the BarCodeReader() constructor or the setBarCodeImage method.
Aspose.BarCode for Python via Java supports barcode recognition for 60+ various barcode types. To improve the efficiency of the recognition process and optimize its timing, it is recommended to set target symbologies in advance. Otheriwse, the DecodeType.ALL_SUPPORTED_TYPES setting of the DecodeType enum will be used by default meaning that the library will look over all supported barcode types to check for their presence in the source image. Using this setting will increase the time needed to complete barcode recognition.
Target barcode types can be specified by grouping them in a list and passing it to the BarCodeReader constructor or the setBarCodeReadType method.
Class DecodeType provides the following symbology setsfor barcode reading:
The required set can be specified in the BarCodeReader constructor or passed to the setBarCodeReadType method.
In Aspose.BarCode for Python via Java, it is possible to specify target areas for barcode detection by creating one or several objects of the Rectangle type. Setting target regions allows improving recognition efficiency and avoiding the regions without any barcodes. Target areas have to be determined accurately as the Aspose library apply heuristic approaches to identify target barcode detection areas. Focusing on too many image regions can lead to recognition efficiency deterioration.
To set one target area for barcode recognition, it is necessary to create an object of the Rectangle type and then pass it to the BarCodeReader constructor or the setBarCodeImage method.
It is also possible to set several target areas for barcode detection within the one source image. This can be done in the same way as described above for one target region, i.e., using the BarCodeReader constructor or the setBarCodeImage method.
Class BarCodeReader enables two special methods to stop the recognition process if it becomes unfeasible to complete. The first one is the setTimeOut method that can be called to interrupt the barcode reading process immediately after the timeout value gets exceeded. By default, the TimeOut value is set to 0.
The second way is to use the abort() method. This option is used if the recognition process has been launched in the other thread. This method does not stop the entire process and returns controls immediately.
Both aforementioned methods throw an exception called RecognitionAbortedException if the recognition process could not be finished successfully.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.