![]() |
Aspose.Barcode for Python via Java Generation and Recognition API docs
|
BarCodeReader encapsulates an image which may contain one or several barcodes, it then can perform ReadBarCodes operation to detect barcodes. More...
Inherits BaseJavaClass.
Public Member Functions | |
| def | __init__ (self, Union[str, Image.Image, None] image, Optional[Union[List[Assist.Rectangle], Assist.Rectangle]] areas, Optional[Union[List[DecodeType], DecodeType]] decodeTypes) |
| Initializes a new instance of the BarCodeReader. More... | |
| None | abort (self) |
| bool | containsAny (self, Union[List[DecodeType], DecodeType] decodeTypes) |
| Determines whether any of the given decode types is included. More... | |
| bool | exportToXml (self, str xmlFile) |
| Exports BarCode properties to the xml-file specified. More... | |
| List[DecodeType] | getBarCodeDecodeType (self) |
| Gets the decode type of the input barcode decoding. More... | |
| Optional[BarcodeSettings] | getBarcodeSettings (self) |
| The main BarCode decoding parameters. More... | |
| Optional[List[BarCodeResult]] | getFoundBarCodes (self) |
| Gets recognized BarCodeResult array. More... | |
| int | getFoundCount (self) |
| Gets recognized barcodes count. More... | |
| Optional[QualitySettings] | getQualitySettings (self) |
| QualitySettings allows to configure recognition quality and speed manually. More... | |
| int | getTimeout (self) |
| Gets the timeout of recognition process in milliseconds. More... | |
| None | init (self) |
| Optional[List[BarCodeResult]] | readBarCodes (self) |
| Reads BarCodeResult from the image. More... | |
| None | setBarCodeImage (self, Union[str, Image.Image] imageResource, Optional[Union[List[Assist.Rectangle], Assist.Rectangle]] areas) |
| Sets bitmap image and areas for Recognition. More... | |
| None | setBarCodeReadType (self, Union[List[DecodeType], DecodeType] types) |
| Sets SingleDecodeType type array for Recognition. More... | |
| None | setQualitySettings (self, QualitySettings value) |
| QualitySettings allows to configure recognition quality and speed manually. More... | |
| None | setTimeout (self, int value) |
| Sets the timeout of recognition process in milliseconds. More... | |
Public Member Functions inherited from BaseJavaClass | |
| None | __init__ (self, javaClass) |
| def | getJavaClass (self) |
| str | getJavaClassName (self) |
| bool | isNull (self) |
| None | printJavaClassName (self) |
| None | setJavaClass (self, javaClass) |
Static Public Member Functions | |
| BarCodeReader | construct (javaClass) |
| def | convertAreasToJavaFormattedAreas (areas) |
| jpype.JArray | convertDecodeTypeToJavaDecodeType (Optional[Union[List[DecodeType], DecodeType]] decodeTypes) |
| Optional[bytes] | convertToBase64Image (Union[str, Image.Image, None] image) |
| BarCodeReader | importFromXml (str xmlFile) |
| Exports BarCode properties to the xml-file specified. More... | |
Public Attributes | |
| barcodeSettings | |
| qualitySettings | |
| recognizedResults | |
Public Attributes inherited from BaseJavaClass | |
| javaClass | |
| javaClassName | |
Static Public Attributes | |
| string | javaClassName = "com.aspose.mw.barcode.recognition.MwBarCodeReader" |
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.
| def __init__ | ( | self, | |
| Union[str, Image.Image, None] | image, | ||
| Optional[Union[List[Assist.Rectangle], Assist.Rectangle]] | areas, | ||
| Optional[Union[List[DecodeType], DecodeType]] | decodeTypes | ||
| ) |
Initializes a new instance of the BarCodeReader.
| image encoded as base64 string or path to image | |
| areas array of object by type Rectangle | |
| decodeTypes the array of objects by DecodeType |
| None abort | ( | self | ) |
|
static |
| bool containsAny | ( | self, | |
| Union[List[DecodeType], DecodeType] | decodeTypes | ||
| ) |
Determines whether any of the given decode types is included.
| decodeTypes Types to verify. |
|
static |
|
static |
|
static |
| bool exportToXml | ( | self, | |
| str | xmlFile | ||
| ) |
Exports BarCode properties to the xml-file specified.
| xmlFile The name of the file |
| List[DecodeType] getBarCodeDecodeType | ( | self | ) |
Gets the decode type of the input barcode decoding.
| Optional[BarcodeSettings] getBarcodeSettings | ( | self | ) |
The main BarCode decoding parameters.
Contains parameters which make influence on recognized data.
| Optional[List[BarCodeResult]] getFoundBarCodes | ( | self | ) |
Gets recognized BarCodeResult array.
This sample shows how to read barcodes with BarCodeReader
| int getFoundCount | ( | self | ) |
Gets recognized barcodes count.
This sample shows how to read barcodes with BarCodeReader
reader = Recognition.BarCodeReader(self.image_path, None,[Recognition.DecodeType.CODE_39, Recognition.DecodeType.CODE_128])reader.readBarCodes()print(f"\nFound {str(reader.getFoundCount())} barcodes")
- Returns
- The recognized barcodes count
| Optional[QualitySettings] getQualitySettings | ( | self | ) |
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
QualitySettings to configure recognition quality and speed.
| int getTimeout | ( | self | ) |
Gets the timeout of recognition process in milliseconds.
|
static |
Exports BarCode properties to the xml-file specified.
| xmlFile: xmlFile The name of the file |
| None init | ( | self | ) |
Reimplemented from BaseJavaClass.
| Optional[List[BarCodeResult]] readBarCodes | ( | self | ) |
Reads BarCodeResult from the image.
This sample shows how to read barcodes with BarCodeReader
\code
reader = Recognition.BarCodeReader(self.image_path, None, [Recognition.DecodeType.CODE_39, Recognition.DecodeType.CODE_128])
for result in reader.readBarCodes():
print(f"\nBarCode CodeText: {result.getCodeText()}")
reader = Recognition.BarCodeReader(self.image_path, None, [Recognition.DecodeType.CODE_39, Recognition.DecodeType.CODE_128])
reader.readBarCodes()
for result in reader.getFoundBarCodes():
print(f"\nBarCode CodeText: {result.getCodeText()}")
\endcode
@return: Returns array of recognized @code BarCodeResult @endcode s on the image. If nothing is recognized, zero array is returned.
| None setBarCodeImage | ( | self, | |
| Union[str, Image.Image] | imageResource, | ||
| Optional[Union[List[Assist.Rectangle], Assist.Rectangle]] | areas | ||
| ) |
Sets bitmap image and areas for Recognition.
Must be called before ReadBarCodes() method. This sample shows how to detect Code39 and Code128 barcodes.
| imageResource path to image or object of PIL.Image | |
| areas The areas list for recognition |
| BarCodeException |
| None setBarCodeReadType | ( | self, | |
| Union[List[DecodeType], DecodeType] | types | ||
| ) |
Sets SingleDecodeType type array for Recognition.
Must be called before readBarCodes() method.
This sample shows how to detect Code39 and Code128 barcodes.
\code
reader = Recognition.BarCodeReader(self.image_path, None, None)
reader.setBarCodeReadType([Recognition.DecodeType.CODE_39, Recognition.DecodeType.CODE_128])
results = reader.readBarCodes()
for result in results:
print(f"\nBarCode Type: {result.getCodeTypeName()}")
print(f"BarCode CodeText: {result.getCodeText()}")
\endcode
@param: types The SingleDecodeType type array to read.
| None setQualitySettings | ( | self, | |
| 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
QualitySettings to configure recognition quality and speed.
| None setTimeout | ( | self, | |
| int | value | ||
| ) |
Sets the timeout of recognition process in milliseconds.
| value The timeout. |
| barcodeSettings |
|
static |
| qualitySettings |
| recognizedResults |