zxing-cpp 3.1.0__cp314-cp314t-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zxing_cpp-3.1.0.dist-info/METADATA +73 -0
- zxing_cpp-3.1.0.dist-info/RECORD +8 -0
- zxing_cpp-3.1.0.dist-info/WHEEL +5 -0
- zxing_cpp-3.1.0.dist-info/licenses/LICENSE +202 -0
- zxingcpp/__init__.py +3 -0
- zxingcpp/py.typed +0 -0
- zxingcpp/zxingcpp.cp314t-win_amd64.pyd +0 -0
- zxingcpp/zxingcpp.pyi +737 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: zxing-cpp
|
|
3
|
+
Version: 3.1.0
|
|
4
|
+
Summary: Python bindings for the zxing-cpp barcode library
|
|
5
|
+
Keywords: barcode
|
|
6
|
+
Author-Email: zxing-cpp community <zxingcpp@gmail.com>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
13
|
+
Project-URL: Homepage, https://github.com/zxing-cpp/zxing-cpp
|
|
14
|
+
Project-URL: Repository, https://github.com/zxing-cpp/zxing-cpp.git
|
|
15
|
+
Project-URL: Issues, https://github.com/zxing-cpp/zxing-cpp/issues
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# Python bindings for zxing-cpp
|
|
20
|
+
|
|
21
|
+
[](https://pypi.org/project/zxing-cpp/)
|
|
22
|
+
|
|
23
|
+
The package uses [scikit-build-core](https://scikit-build-core.readthedocs.io/) as its build backend and [nanobind](https://nanobind.readthedocs.io/) for the Python bindings.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install zxing-cpp
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
To build from a checked out / extracted soruce tree, a suitable [build environment](https://github.com/zxing-cpp/zxing-cpp#build-instructions) including a C++20 compiler is required:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install .
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
### Reading barcodes
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
import cv2, zxingcpp
|
|
44
|
+
|
|
45
|
+
img = cv2.imread('test.png')
|
|
46
|
+
barcodes = zxingcpp.read_barcodes(img)
|
|
47
|
+
for barcode in barcodes:
|
|
48
|
+
print('Found barcode:'
|
|
49
|
+
f'\n Text: "{barcode.text}"'
|
|
50
|
+
f'\n Format: {barcode.format}'
|
|
51
|
+
f'\n Content: {barcode.content_type}'
|
|
52
|
+
f'\n Position: {barcode.position}')
|
|
53
|
+
if len(barcodes) == 0:
|
|
54
|
+
print("Could not find any barcode.")
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Writing barcodes
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
import zxingcpp
|
|
61
|
+
from PIL import Image
|
|
62
|
+
|
|
63
|
+
barcode = zxingcpp.create_barcode('This is a test', zxingcpp.BarcodeFormat.QRCode, ec_level = "50%")
|
|
64
|
+
|
|
65
|
+
img = barcode.to_image(scale = 5)
|
|
66
|
+
Image.fromarray(img).save("test.png")
|
|
67
|
+
|
|
68
|
+
svg = barcode.to_svg(add_quiet_zones = False)
|
|
69
|
+
with open("test.svg", "w") as svg_file:
|
|
70
|
+
svg_file.write(svg)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
To get a full list of available parameters for `read_barcodes` and `create_barcode` as well as the properties of the Barcode objects, have a look at the `nanobind` module definition in [this C++ source file](https://github.com/zxing-cpp/zxing-cpp/blob/master/wrappers/python/zxing.cpp).
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
zxingcpp/__init__.py,sha256=HBB4r-6Pk427uBJRdI1J4rSmWC6S6yIQO1ik3q0BSN4,193
|
|
2
|
+
zxingcpp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
zxingcpp/zxingcpp.cp314t-win_amd64.pyd,sha256=5aZaD1DVoDZGkL4Prh1waVZRvHHAIi2_R426rxP1bMI,1817088
|
|
4
|
+
zxingcpp/zxingcpp.pyi,sha256=0bg4Nng5nuS7qL53RRKnRDN-wQDah312XrdmUXazgU4,20875
|
|
5
|
+
zxing_cpp-3.1.0.dist-info/METADATA,sha256=oAGzW6W2LklFGRpwL1eWRLmXZQji21HCfJgU8UgOAx8,2322
|
|
6
|
+
zxing_cpp-3.1.0.dist-info/WHEEL,sha256=7KbTWvdsNGsmArp6uGKLCSPm2BMtf-UOMdCZcd6Xepo,106
|
|
7
|
+
zxing_cpp-3.1.0.dist-info/licenses/LICENSE,sha256=LlTNhKZFvqJZQ8dd2K5nyykeZqR6EVeDM8m0s7a4bIU,11560
|
|
8
|
+
zxing_cpp-3.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
zxingcpp/__init__.py
ADDED
zxingcpp/py.typed
ADDED
|
File without changes
|
|
Binary file
|
zxingcpp/zxingcpp.pyi
ADDED
|
@@ -0,0 +1,737 @@
|
|
|
1
|
+
"""python bindings for zxing-cpp"""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterator, Sequence
|
|
4
|
+
import enum
|
|
5
|
+
from typing import Annotated, TypeAlias, overload
|
|
6
|
+
|
|
7
|
+
from numpy.typing import NDArray
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BarcodeFormats:
|
|
11
|
+
@overload
|
|
12
|
+
def __init__(self, arg: BarcodeFormat, /) -> None: ...
|
|
13
|
+
|
|
14
|
+
@overload
|
|
15
|
+
def __init__(self, arg: Sequence[BarcodeFormat], /) -> None: ...
|
|
16
|
+
|
|
17
|
+
def __repr__(self) -> str: ...
|
|
18
|
+
|
|
19
|
+
def __eq__(self, arg: BarcodeFormats, /) -> bool: ...
|
|
20
|
+
|
|
21
|
+
def __or__(self, arg: BarcodeFormat, /) -> BarcodeFormats: ...
|
|
22
|
+
|
|
23
|
+
def __len__(self) -> int: ...
|
|
24
|
+
|
|
25
|
+
def __iter__(self) -> Iterator[BarcodeFormat]: ...
|
|
26
|
+
|
|
27
|
+
def __getitem__(self, arg: int, /) -> BarcodeFormat: ...
|
|
28
|
+
|
|
29
|
+
class BarcodeFormat(enum.IntEnum):
|
|
30
|
+
"""Enumeration of zxing supported barcode formats"""
|
|
31
|
+
|
|
32
|
+
def __str__(self) -> str: ...
|
|
33
|
+
|
|
34
|
+
None = 0
|
|
35
|
+
|
|
36
|
+
All = 10794
|
|
37
|
+
|
|
38
|
+
AllReadable = 29226
|
|
39
|
+
|
|
40
|
+
AllCreatable = 30506
|
|
41
|
+
|
|
42
|
+
AllLinear = 27690
|
|
43
|
+
|
|
44
|
+
AllMatrix = 27946
|
|
45
|
+
|
|
46
|
+
AllGS1 = 18218
|
|
47
|
+
|
|
48
|
+
AllRetail = 21034
|
|
49
|
+
|
|
50
|
+
AllIndustrial = 18730
|
|
51
|
+
|
|
52
|
+
Codabar = 8262
|
|
53
|
+
|
|
54
|
+
Code39 = 8257
|
|
55
|
+
|
|
56
|
+
Code39Std = 29505
|
|
57
|
+
|
|
58
|
+
Code39Ext = 25921
|
|
59
|
+
|
|
60
|
+
Code32 = 12865
|
|
61
|
+
|
|
62
|
+
PZN = 28737
|
|
63
|
+
|
|
64
|
+
Code93 = 8263
|
|
65
|
+
|
|
66
|
+
Code128 = 8259
|
|
67
|
+
|
|
68
|
+
ITF = 8265
|
|
69
|
+
|
|
70
|
+
ITF14 = 13385
|
|
71
|
+
|
|
72
|
+
DataBar = 8293
|
|
73
|
+
|
|
74
|
+
DataBarOmni = 28517
|
|
75
|
+
|
|
76
|
+
DataBarStk = 29541
|
|
77
|
+
|
|
78
|
+
DataBarStkOmni = 20325
|
|
79
|
+
|
|
80
|
+
DataBarLtd = 27749
|
|
81
|
+
|
|
82
|
+
DataBarExp = 25957
|
|
83
|
+
|
|
84
|
+
DataBarExpStk = 17765
|
|
85
|
+
|
|
86
|
+
EANUPC = 8261
|
|
87
|
+
|
|
88
|
+
EAN13 = 12613
|
|
89
|
+
|
|
90
|
+
EAN8 = 14405
|
|
91
|
+
|
|
92
|
+
EAN5 = 13637
|
|
93
|
+
|
|
94
|
+
EAN2 = 12869
|
|
95
|
+
|
|
96
|
+
ISBN = 26949
|
|
97
|
+
|
|
98
|
+
UPCA = 24901
|
|
99
|
+
|
|
100
|
+
UPCE = 25925
|
|
101
|
+
|
|
102
|
+
Telepen = 8258
|
|
103
|
+
|
|
104
|
+
TelepenAlpha = 12354
|
|
105
|
+
|
|
106
|
+
TelepenNumeric = 12610
|
|
107
|
+
|
|
108
|
+
OtherBarcode = 8280
|
|
109
|
+
|
|
110
|
+
DXFilmEdge = 30808
|
|
111
|
+
|
|
112
|
+
PDF417 = 8268
|
|
113
|
+
|
|
114
|
+
CompactPDF417 = 25420
|
|
115
|
+
|
|
116
|
+
MicroPDF417 = 27980
|
|
117
|
+
|
|
118
|
+
Aztec = 8314
|
|
119
|
+
|
|
120
|
+
AztecCode = 25466
|
|
121
|
+
|
|
122
|
+
AztecRune = 29306
|
|
123
|
+
|
|
124
|
+
QRCode = 8273
|
|
125
|
+
|
|
126
|
+
QRCodeModel1 = 12625
|
|
127
|
+
|
|
128
|
+
QRCodeModel2 = 12881
|
|
129
|
+
|
|
130
|
+
MicroQRCode = 27985
|
|
131
|
+
|
|
132
|
+
RMQRCode = 29265
|
|
133
|
+
|
|
134
|
+
DataMatrix = 8292
|
|
135
|
+
|
|
136
|
+
MaxiCode = 8277
|
|
137
|
+
|
|
138
|
+
NONE = 0
|
|
139
|
+
|
|
140
|
+
DataBarExpanded = 25957
|
|
141
|
+
|
|
142
|
+
DataBarLimited = 27749
|
|
143
|
+
|
|
144
|
+
LinearCodes = 27690
|
|
145
|
+
|
|
146
|
+
MatrixCodes = 27946
|
|
147
|
+
|
|
148
|
+
def __or__(self, arg: BarcodeFormat, /) -> BarcodeFormats: ...
|
|
149
|
+
|
|
150
|
+
@property
|
|
151
|
+
def symbology(self) -> BarcodeFormat: ...
|
|
152
|
+
|
|
153
|
+
None: ErrorType = ErrorType.None
|
|
154
|
+
|
|
155
|
+
All: BarcodeFormat = BarcodeFormat.All
|
|
156
|
+
|
|
157
|
+
AllReadable: BarcodeFormat = BarcodeFormat.AllReadable
|
|
158
|
+
|
|
159
|
+
AllCreatable: BarcodeFormat = BarcodeFormat.AllCreatable
|
|
160
|
+
|
|
161
|
+
AllLinear: BarcodeFormat = BarcodeFormat.AllLinear
|
|
162
|
+
|
|
163
|
+
AllMatrix: BarcodeFormat = BarcodeFormat.AllMatrix
|
|
164
|
+
|
|
165
|
+
AllGS1: BarcodeFormat = BarcodeFormat.AllGS1
|
|
166
|
+
|
|
167
|
+
AllRetail: BarcodeFormat = BarcodeFormat.AllRetail
|
|
168
|
+
|
|
169
|
+
AllIndustrial: BarcodeFormat = BarcodeFormat.AllIndustrial
|
|
170
|
+
|
|
171
|
+
Codabar: BarcodeFormat = BarcodeFormat.Codabar
|
|
172
|
+
|
|
173
|
+
Code39: BarcodeFormat = BarcodeFormat.Code39
|
|
174
|
+
|
|
175
|
+
Code39Std: BarcodeFormat = BarcodeFormat.Code39Std
|
|
176
|
+
|
|
177
|
+
Code39Ext: BarcodeFormat = BarcodeFormat.Code39Ext
|
|
178
|
+
|
|
179
|
+
Code32: BarcodeFormat = BarcodeFormat.Code32
|
|
180
|
+
|
|
181
|
+
PZN: BarcodeFormat = BarcodeFormat.PZN
|
|
182
|
+
|
|
183
|
+
Code93: BarcodeFormat = BarcodeFormat.Code93
|
|
184
|
+
|
|
185
|
+
Code128: BarcodeFormat = BarcodeFormat.Code128
|
|
186
|
+
|
|
187
|
+
ITF: BarcodeFormat = BarcodeFormat.ITF
|
|
188
|
+
|
|
189
|
+
ITF14: BarcodeFormat = BarcodeFormat.ITF14
|
|
190
|
+
|
|
191
|
+
DataBar: BarcodeFormat = BarcodeFormat.DataBar
|
|
192
|
+
|
|
193
|
+
DataBarOmni: BarcodeFormat = BarcodeFormat.DataBarOmni
|
|
194
|
+
|
|
195
|
+
DataBarStk: BarcodeFormat = BarcodeFormat.DataBarStk
|
|
196
|
+
|
|
197
|
+
DataBarStkOmni: BarcodeFormat = BarcodeFormat.DataBarStkOmni
|
|
198
|
+
|
|
199
|
+
DataBarLtd: BarcodeFormat = BarcodeFormat.DataBarLtd
|
|
200
|
+
|
|
201
|
+
DataBarExp: BarcodeFormat = BarcodeFormat.DataBarExp
|
|
202
|
+
|
|
203
|
+
DataBarExpStk: BarcodeFormat = BarcodeFormat.DataBarExpStk
|
|
204
|
+
|
|
205
|
+
EANUPC: BarcodeFormat = BarcodeFormat.EANUPC
|
|
206
|
+
|
|
207
|
+
EAN13: BarcodeFormat = BarcodeFormat.EAN13
|
|
208
|
+
|
|
209
|
+
EAN8: BarcodeFormat = BarcodeFormat.EAN8
|
|
210
|
+
|
|
211
|
+
EAN5: BarcodeFormat = BarcodeFormat.EAN5
|
|
212
|
+
|
|
213
|
+
EAN2: BarcodeFormat = BarcodeFormat.EAN2
|
|
214
|
+
|
|
215
|
+
ISBN: BarcodeFormat = BarcodeFormat.ISBN
|
|
216
|
+
|
|
217
|
+
UPCA: BarcodeFormat = BarcodeFormat.UPCA
|
|
218
|
+
|
|
219
|
+
UPCE: BarcodeFormat = BarcodeFormat.UPCE
|
|
220
|
+
|
|
221
|
+
Telepen: BarcodeFormat = BarcodeFormat.Telepen
|
|
222
|
+
|
|
223
|
+
TelepenAlpha: BarcodeFormat = BarcodeFormat.TelepenAlpha
|
|
224
|
+
|
|
225
|
+
TelepenNumeric: BarcodeFormat = BarcodeFormat.TelepenNumeric
|
|
226
|
+
|
|
227
|
+
OtherBarcode: BarcodeFormat = BarcodeFormat.OtherBarcode
|
|
228
|
+
|
|
229
|
+
DXFilmEdge: BarcodeFormat = BarcodeFormat.DXFilmEdge
|
|
230
|
+
|
|
231
|
+
PDF417: BarcodeFormat = BarcodeFormat.PDF417
|
|
232
|
+
|
|
233
|
+
CompactPDF417: BarcodeFormat = BarcodeFormat.CompactPDF417
|
|
234
|
+
|
|
235
|
+
MicroPDF417: BarcodeFormat = BarcodeFormat.MicroPDF417
|
|
236
|
+
|
|
237
|
+
Aztec: BarcodeFormat = BarcodeFormat.Aztec
|
|
238
|
+
|
|
239
|
+
AztecCode: BarcodeFormat = BarcodeFormat.AztecCode
|
|
240
|
+
|
|
241
|
+
AztecRune: BarcodeFormat = BarcodeFormat.AztecRune
|
|
242
|
+
|
|
243
|
+
QRCode: BarcodeFormat = BarcodeFormat.QRCode
|
|
244
|
+
|
|
245
|
+
QRCodeModel1: BarcodeFormat = BarcodeFormat.QRCodeModel1
|
|
246
|
+
|
|
247
|
+
QRCodeModel2: BarcodeFormat = BarcodeFormat.QRCodeModel2
|
|
248
|
+
|
|
249
|
+
MicroQRCode: BarcodeFormat = BarcodeFormat.MicroQRCode
|
|
250
|
+
|
|
251
|
+
RMQRCode: BarcodeFormat = BarcodeFormat.RMQRCode
|
|
252
|
+
|
|
253
|
+
DataMatrix: BarcodeFormat = BarcodeFormat.DataMatrix
|
|
254
|
+
|
|
255
|
+
MaxiCode: BarcodeFormat = BarcodeFormat.MaxiCode
|
|
256
|
+
|
|
257
|
+
class Binarizer(enum.Enum):
|
|
258
|
+
"""Enumeration of binarizers used before decoding images"""
|
|
259
|
+
|
|
260
|
+
BoolCast = 3
|
|
261
|
+
|
|
262
|
+
FixedThreshold = 2
|
|
263
|
+
|
|
264
|
+
GlobalHistogram = 1
|
|
265
|
+
|
|
266
|
+
LocalAverage = 0
|
|
267
|
+
|
|
268
|
+
BoolCast: Binarizer = Binarizer.BoolCast
|
|
269
|
+
|
|
270
|
+
FixedThreshold: Binarizer = Binarizer.FixedThreshold
|
|
271
|
+
|
|
272
|
+
GlobalHistogram: Binarizer = Binarizer.GlobalHistogram
|
|
273
|
+
|
|
274
|
+
LocalAverage: Binarizer = Binarizer.LocalAverage
|
|
275
|
+
|
|
276
|
+
class EanAddOnSymbol(enum.Enum):
|
|
277
|
+
"""Enumeration of options for EAN-2/5 add-on symbols check"""
|
|
278
|
+
|
|
279
|
+
Ignore = 0
|
|
280
|
+
"""Ignore any Add-On symbol during read/scan"""
|
|
281
|
+
|
|
282
|
+
Read = 1
|
|
283
|
+
"""Read EAN-2/EAN-5 Add-On symbol if found"""
|
|
284
|
+
|
|
285
|
+
Require = 2
|
|
286
|
+
"""Require EAN-2/EAN-5 Add-On symbol to be present"""
|
|
287
|
+
|
|
288
|
+
Ignore: EanAddOnSymbol = EanAddOnSymbol.Ignore
|
|
289
|
+
|
|
290
|
+
Read: EanAddOnSymbol = EanAddOnSymbol.Read
|
|
291
|
+
|
|
292
|
+
Require: EanAddOnSymbol = EanAddOnSymbol.Require
|
|
293
|
+
|
|
294
|
+
class ContentType(enum.Enum):
|
|
295
|
+
"""Enumeration of content types"""
|
|
296
|
+
|
|
297
|
+
Text = 0
|
|
298
|
+
|
|
299
|
+
Binary = 1
|
|
300
|
+
|
|
301
|
+
Mixed = 2
|
|
302
|
+
|
|
303
|
+
GS1 = 3
|
|
304
|
+
|
|
305
|
+
ISO15434 = 4
|
|
306
|
+
|
|
307
|
+
UnknownECI = 5
|
|
308
|
+
|
|
309
|
+
Text: ContentType = ContentType.Text
|
|
310
|
+
|
|
311
|
+
Binary: ContentType = ContentType.Binary
|
|
312
|
+
|
|
313
|
+
Mixed: ContentType = ContentType.Mixed
|
|
314
|
+
|
|
315
|
+
GS1: ContentType = ContentType.GS1
|
|
316
|
+
|
|
317
|
+
ISO15434: ContentType = ContentType.ISO15434
|
|
318
|
+
|
|
319
|
+
UnknownECI: ContentType = ContentType.UnknownECI
|
|
320
|
+
|
|
321
|
+
class TextMode(enum.Enum):
|
|
322
|
+
Plain = 0
|
|
323
|
+
"""
|
|
324
|
+
bytes() transcoded to unicode based on ECI info or guessed charset (the default mode prior to 2.0)
|
|
325
|
+
"""
|
|
326
|
+
|
|
327
|
+
ECI = 1
|
|
328
|
+
"""
|
|
329
|
+
standard content following the ECI protocol with every character set ECI segment transcoded to unicode
|
|
330
|
+
"""
|
|
331
|
+
|
|
332
|
+
HRI = 2
|
|
333
|
+
"""Human Readable Interpretation (dependent on the ContentType)"""
|
|
334
|
+
|
|
335
|
+
Escaped = 3
|
|
336
|
+
"""
|
|
337
|
+
Use the EscapeNonGraphical() function (e.g. ASCII 29 will be transcoded to '<GS>'
|
|
338
|
+
"""
|
|
339
|
+
|
|
340
|
+
Hex = 4
|
|
341
|
+
"""bytes() transcoded to ASCII string of HEX values"""
|
|
342
|
+
|
|
343
|
+
HexECI = 5
|
|
344
|
+
"""bytesECI() transcoded to ASCII string of HEX values"""
|
|
345
|
+
|
|
346
|
+
Plain: TextMode = TextMode.Plain
|
|
347
|
+
|
|
348
|
+
ECI: TextMode = TextMode.ECI
|
|
349
|
+
|
|
350
|
+
HRI: TextMode = TextMode.HRI
|
|
351
|
+
|
|
352
|
+
Escaped: TextMode = TextMode.Escaped
|
|
353
|
+
|
|
354
|
+
Hex: TextMode = TextMode.Hex
|
|
355
|
+
|
|
356
|
+
HexECI: TextMode = TextMode.HexECI
|
|
357
|
+
|
|
358
|
+
class ImageFormat(enum.Enum):
|
|
359
|
+
"""Enumeration of image formats supported by read_barcodes"""
|
|
360
|
+
|
|
361
|
+
Lum = 16777216
|
|
362
|
+
|
|
363
|
+
LumA = 33554432
|
|
364
|
+
|
|
365
|
+
RGB = 50331906
|
|
366
|
+
|
|
367
|
+
BGR = 50462976
|
|
368
|
+
|
|
369
|
+
RGBA = 67109122
|
|
370
|
+
|
|
371
|
+
ARGB = 67174915
|
|
372
|
+
|
|
373
|
+
BGRA = 67240192
|
|
374
|
+
|
|
375
|
+
ABGR = 67305985
|
|
376
|
+
|
|
377
|
+
Lum: ImageFormat = ImageFormat.Lum
|
|
378
|
+
|
|
379
|
+
LumA: ImageFormat = ImageFormat.LumA
|
|
380
|
+
|
|
381
|
+
RGB: ImageFormat = ImageFormat.RGB
|
|
382
|
+
|
|
383
|
+
BGR: ImageFormat = ImageFormat.BGR
|
|
384
|
+
|
|
385
|
+
RGBA: ImageFormat = ImageFormat.RGBA
|
|
386
|
+
|
|
387
|
+
ARGB: ImageFormat = ImageFormat.ARGB
|
|
388
|
+
|
|
389
|
+
BGRA: ImageFormat = ImageFormat.BGRA
|
|
390
|
+
|
|
391
|
+
ABGR: ImageFormat = ImageFormat.ABGR
|
|
392
|
+
|
|
393
|
+
class Point:
|
|
394
|
+
"""Represents the coordinates of a point in an image"""
|
|
395
|
+
|
|
396
|
+
@property
|
|
397
|
+
def x(self) -> int:
|
|
398
|
+
"""
|
|
399
|
+
:return: horizontal coordinate of the point
|
|
400
|
+
:rtype: int
|
|
401
|
+
"""
|
|
402
|
+
|
|
403
|
+
@property
|
|
404
|
+
def y(self) -> int:
|
|
405
|
+
"""
|
|
406
|
+
:return: vertical coordinate of the point
|
|
407
|
+
:rtype: int
|
|
408
|
+
"""
|
|
409
|
+
|
|
410
|
+
class Position:
|
|
411
|
+
"""The position of a decoded symbol"""
|
|
412
|
+
|
|
413
|
+
@property
|
|
414
|
+
def top_left(self) -> Point:
|
|
415
|
+
"""
|
|
416
|
+
:return: coordinate of the symbol's top-left corner
|
|
417
|
+
:rtype: zxingcpp.Point
|
|
418
|
+
"""
|
|
419
|
+
|
|
420
|
+
@property
|
|
421
|
+
def top_right(self) -> Point:
|
|
422
|
+
"""
|
|
423
|
+
:return: coordinate of the symbol's top-right corner
|
|
424
|
+
:rtype: zxingcpp.Point
|
|
425
|
+
"""
|
|
426
|
+
|
|
427
|
+
@property
|
|
428
|
+
def bottom_left(self) -> Point:
|
|
429
|
+
"""
|
|
430
|
+
:return: coordinate of the symbol's bottom-left corner
|
|
431
|
+
:rtype: zxingcpp.Point
|
|
432
|
+
"""
|
|
433
|
+
|
|
434
|
+
@property
|
|
435
|
+
def bottom_right(self) -> Point:
|
|
436
|
+
"""
|
|
437
|
+
:return: coordinate of the symbol's bottom-right corner
|
|
438
|
+
:rtype: zxingcpp.Point
|
|
439
|
+
"""
|
|
440
|
+
|
|
441
|
+
def __str__(self) -> str: ...
|
|
442
|
+
|
|
443
|
+
class ErrorType(enum.Enum):
|
|
444
|
+
None = 0
|
|
445
|
+
"""No error"""
|
|
446
|
+
|
|
447
|
+
Format = 1
|
|
448
|
+
"""Data format error"""
|
|
449
|
+
|
|
450
|
+
Checksum = 2
|
|
451
|
+
"""Checksum error"""
|
|
452
|
+
|
|
453
|
+
Unsupported = 3
|
|
454
|
+
"""Unsupported content error"""
|
|
455
|
+
|
|
456
|
+
Format: ErrorType = ErrorType.Format
|
|
457
|
+
|
|
458
|
+
Checksum: ErrorType = ErrorType.Checksum
|
|
459
|
+
|
|
460
|
+
Unsupported: ErrorType = ErrorType.Unsupported
|
|
461
|
+
|
|
462
|
+
class Error:
|
|
463
|
+
"""Barcode reading error"""
|
|
464
|
+
|
|
465
|
+
@property
|
|
466
|
+
def type(self) -> ErrorType:
|
|
467
|
+
"""
|
|
468
|
+
:return: Error type
|
|
469
|
+
:rtype: zxingcpp.ErrorType
|
|
470
|
+
"""
|
|
471
|
+
|
|
472
|
+
@property
|
|
473
|
+
def message(self) -> str:
|
|
474
|
+
"""
|
|
475
|
+
:return: Error message
|
|
476
|
+
:rtype: str
|
|
477
|
+
"""
|
|
478
|
+
|
|
479
|
+
def __str__(self) -> str: ...
|
|
480
|
+
|
|
481
|
+
class Barcode:
|
|
482
|
+
"""The Barcode class"""
|
|
483
|
+
|
|
484
|
+
@property
|
|
485
|
+
def valid(self) -> bool:
|
|
486
|
+
"""
|
|
487
|
+
:return: whether or not barcode is valid (i.e. a symbol was found and decoded)
|
|
488
|
+
:rtype: bool
|
|
489
|
+
"""
|
|
490
|
+
|
|
491
|
+
@property
|
|
492
|
+
def text(self) -> str:
|
|
493
|
+
"""
|
|
494
|
+
:return: text of the decoded symbol (see also TextMode parameter)
|
|
495
|
+
:rtype: str
|
|
496
|
+
"""
|
|
497
|
+
|
|
498
|
+
@property
|
|
499
|
+
def bytes(self) -> bytes:
|
|
500
|
+
"""
|
|
501
|
+
:return: uninterpreted bytes of the decoded symbol
|
|
502
|
+
:rtype: bytes
|
|
503
|
+
"""
|
|
504
|
+
|
|
505
|
+
@property
|
|
506
|
+
def format(self) -> BarcodeFormat:
|
|
507
|
+
"""
|
|
508
|
+
:return: decoded symbol format
|
|
509
|
+
:rtype: zxingcpp.BarcodeFormat
|
|
510
|
+
"""
|
|
511
|
+
|
|
512
|
+
@property
|
|
513
|
+
def symbology(self) -> BarcodeFormat:
|
|
514
|
+
"""
|
|
515
|
+
:return: decoded symbol symbology
|
|
516
|
+
:rtype: zxingcpp.BarcodeFormat
|
|
517
|
+
"""
|
|
518
|
+
|
|
519
|
+
@property
|
|
520
|
+
def symbology_identifier(self) -> str:
|
|
521
|
+
"""
|
|
522
|
+
:return: decoded symbology idendifier
|
|
523
|
+
:rtype: str
|
|
524
|
+
"""
|
|
525
|
+
|
|
526
|
+
@property
|
|
527
|
+
def ec_level(self) -> str:
|
|
528
|
+
"""
|
|
529
|
+
:return: error correction level of the symbol (empty string if not applicable)
|
|
530
|
+
:rtype: str
|
|
531
|
+
"""
|
|
532
|
+
|
|
533
|
+
@property
|
|
534
|
+
def content_type(self) -> ContentType:
|
|
535
|
+
"""
|
|
536
|
+
:return: content type of symbol
|
|
537
|
+
:rtype: zxingcpp.ContentType
|
|
538
|
+
"""
|
|
539
|
+
|
|
540
|
+
@property
|
|
541
|
+
def position(self) -> Position:
|
|
542
|
+
"""
|
|
543
|
+
:return: position of the decoded symbol
|
|
544
|
+
:rtype: zxingcpp.Position
|
|
545
|
+
"""
|
|
546
|
+
|
|
547
|
+
@property
|
|
548
|
+
def orientation(self) -> int:
|
|
549
|
+
"""
|
|
550
|
+
:return: orientation (in degree) of the decoded symbol
|
|
551
|
+
:rtype: int
|
|
552
|
+
"""
|
|
553
|
+
|
|
554
|
+
@property
|
|
555
|
+
def error(self) -> Error | None:
|
|
556
|
+
"""
|
|
557
|
+
:return: Error code or None
|
|
558
|
+
:rtype: zxingcpp.Error
|
|
559
|
+
"""
|
|
560
|
+
|
|
561
|
+
@property
|
|
562
|
+
def extra(self) -> object:
|
|
563
|
+
"""
|
|
564
|
+
:return: Symbology specific extra information as a Python dictionary (might be empty)
|
|
565
|
+
:rtype: dict
|
|
566
|
+
"""
|
|
567
|
+
|
|
568
|
+
def to_image(self, scale: int = 1, add_hrt: bool = False, add_quiet_zones: bool = True) -> Image: ...
|
|
569
|
+
|
|
570
|
+
def to_svg(self, scale: int = 1, add_hrt: bool = False, add_quiet_zones: bool = True) -> str: ...
|
|
571
|
+
|
|
572
|
+
Result: TypeAlias = Barcode
|
|
573
|
+
|
|
574
|
+
def barcode_format_from_str(str: str) -> BarcodeFormat:
|
|
575
|
+
"""
|
|
576
|
+
Convert string to BarcodeFormat
|
|
577
|
+
|
|
578
|
+
:type str: str
|
|
579
|
+
:param str: string representing barcode format
|
|
580
|
+
:return: corresponding barcode format
|
|
581
|
+
:rtype: zxingcpp.BarcodeFormat
|
|
582
|
+
"""
|
|
583
|
+
|
|
584
|
+
def barcode_formats_from_str(str: str) -> BarcodeFormats:
|
|
585
|
+
"""
|
|
586
|
+
Convert string to BarcodeFormats
|
|
587
|
+
|
|
588
|
+
:type str: str
|
|
589
|
+
:param str: string representing a list of barcodes formats
|
|
590
|
+
:return: corresponding barcode formats
|
|
591
|
+
:rtype: zxingcpp.BarcodeFormats
|
|
592
|
+
"""
|
|
593
|
+
|
|
594
|
+
def barcode_formats_list(filter: BarcodeFormats = ...) -> BarcodeFormats:
|
|
595
|
+
"""
|
|
596
|
+
Returns a list of available/supported barcode formats, optionally filtered by the provided format(s).
|
|
597
|
+
|
|
598
|
+
:type filter: zxingcpp.BarcodeFormats
|
|
599
|
+
:param filter: the BarcodeFormat(s) to filter by
|
|
600
|
+
:return: list of available/supported barcode formats (optionally filtered)
|
|
601
|
+
:rtype: list[zxingcpp.BarcodeFormat]
|
|
602
|
+
"""
|
|
603
|
+
|
|
604
|
+
def read_barcode(image: object, formats: BarcodeFormats = ..., try_rotate: bool = True, try_downscale: bool = True, try_invert: bool = True, text_mode: TextMode = TextMode.HRI, binarizer: Binarizer = Binarizer.LocalAverage, is_pure: bool = False, ean_add_on_symbol: EanAddOnSymbol = EanAddOnSymbol.Ignore, return_errors: bool = False) -> Barcode | None:
|
|
605
|
+
"""
|
|
606
|
+
Read (decode) a barcode from a numpy BGR or grayscale image array or from a PIL image.
|
|
607
|
+
|
|
608
|
+
:type image: buffer|numpy.ndarray|PIL.Image.Image
|
|
609
|
+
:param image: The image object to decode. The image can be either:
|
|
610
|
+
- a buffer with the correct shape, use .cast on memory view to convert
|
|
611
|
+
- a numpy array containing image either in grayscale (1 byte per pixel) or BGR mode (3 bytes per pixel)
|
|
612
|
+
- a PIL Image
|
|
613
|
+
- a QtGui.QImage
|
|
614
|
+
- a zxingcpp.ImageView object, which is effectively a memory view but with custom strides and ImageFormat
|
|
615
|
+
:type formats: zxing.BarcodeFormat|zxing.BarcodeFormats
|
|
616
|
+
:param formats: the format(s) to decode. If ``None``, decode all formats.
|
|
617
|
+
:type try_rotate: bool
|
|
618
|
+
:param try_rotate: if ``True`` (the default), decoder searches for barcodes in any direction;
|
|
619
|
+
if ``False``, it will not search for 90° / 270° rotated barcodes.
|
|
620
|
+
:type try_downscale: bool
|
|
621
|
+
:param try_downscale: if ``True`` (the default), decoder also scans downscaled versions of the input;
|
|
622
|
+
if ``False``, it will only search in the resolution provided.
|
|
623
|
+
:type try_invert: bool
|
|
624
|
+
:param try_invert: if ``True`` (the default), decoder also tries inverted (light on dark) barcodes.
|
|
625
|
+
:type text_mode: zxing.TextMode
|
|
626
|
+
:param text_mode: specifies the TextMode that governs how the raw bytes content is transcoded to text.
|
|
627
|
+
Defaults to :py:attr:`zxing.TextMode.HRI`.:type binarizer: zxing.Binarizer
|
|
628
|
+
:param binarizer: the binarizer used to convert image before decoding barcodes.
|
|
629
|
+
Defaults to :py:attr:`zxing.Binarizer.LocalAverage`.:type is_pure: bool
|
|
630
|
+
:param is_pure: Set to True if the input contains nothing but a perfectly aligned barcode (generated image).
|
|
631
|
+
Speeds up detection in that case. Default is False.:type ean_add_on_symbol: zxing.EanAddOnSymbol
|
|
632
|
+
:param ean_add_on_symbol: Specify whether to Ignore, Read or Require EAN-2/5 add-on symbols while scanning
|
|
633
|
+
EAN/UPC codes. Default is ``Ignore``.
|
|
634
|
+
:type return_errors: bool
|
|
635
|
+
:param return_errors: Set to True to return the barcodes with errors as well (e.g. checksum errors); see ``Barcode.error``.
|
|
636
|
+
Default is False.:rtype: zxingcpp.Barcode
|
|
637
|
+
:return: a Barcode if found, None otherwise
|
|
638
|
+
"""
|
|
639
|
+
|
|
640
|
+
def read_barcodes(image: object, formats: BarcodeFormats = ..., try_rotate: bool = True, try_downscale: bool = True, try_invert: bool = True, text_mode: TextMode = TextMode.HRI, binarizer: Binarizer = Binarizer.LocalAverage, is_pure: bool = False, ean_add_on_symbol: EanAddOnSymbol = EanAddOnSymbol.Ignore, return_errors: bool = False) -> list[Barcode]:
|
|
641
|
+
"""
|
|
642
|
+
Read (decode) multiple barcodes from a numpy BGR or grayscale image array or from a PIL image.
|
|
643
|
+
|
|
644
|
+
:type image: buffer|numpy.ndarray|PIL.Image.Image
|
|
645
|
+
:param image: The image object to decode. The image can be either:
|
|
646
|
+
- a buffer with the correct shape, use .cast on memoryview to convert
|
|
647
|
+
- a numpy array containing image either in grayscale (1 byte per pixel) or BGR mode (3 bytes per pixel)
|
|
648
|
+
- a PIL Image
|
|
649
|
+
- a QtGui.QImage
|
|
650
|
+
- a zxingcpp.ImageView object, which is effectively a memory view but with custom strides and ImageFormat
|
|
651
|
+
:type formats: zxing.BarcodeFormat|zxing.BarcodeFormats
|
|
652
|
+
:param formats: the format(s) to decode. If ``None``, decode all formats.
|
|
653
|
+
:type try_rotate: bool
|
|
654
|
+
:param try_rotate: if ``True`` (the default), decoder searches for barcodes in any direction;
|
|
655
|
+
if ``False``, it will not search for 90° / 270° rotated barcodes.
|
|
656
|
+
:type try_downscale: bool
|
|
657
|
+
:param try_downscale: if ``True`` (the default), decoder also scans downscaled versions of the input;
|
|
658
|
+
if ``False``, it will only search in the resolution provided.
|
|
659
|
+
:type try_invert: bool
|
|
660
|
+
:param try_invert: if ``True`` (the default), decoder also tries inverted (light on dark) barcodes.
|
|
661
|
+
:type text_mode: zxing.TextMode
|
|
662
|
+
:param text_mode: specifies the TextMode that governs how the raw bytes content is transcoded to text.
|
|
663
|
+
Defaults to :py:attr:`zxing.TextMode.HRI`.:type binarizer: zxing.Binarizer
|
|
664
|
+
:param binarizer: the binarizer used to convert image before decoding barcodes.
|
|
665
|
+
Defaults to :py:attr:`zxing.Binarizer.LocalAverage`.:type is_pure: bool
|
|
666
|
+
:param is_pure: Set to True if the input contains nothing but a perfectly aligned barcode (generated image).
|
|
667
|
+
Speeds up detection in that case. Default is False.:type ean_add_on_symbol: zxing.EanAddOnSymbol
|
|
668
|
+
:param ean_add_on_symbol: Specify whether to Ignore, Read or Require EAN-2/5 add-on symbols while scanning
|
|
669
|
+
EAN/UPC codes. Default is ``Ignore``.
|
|
670
|
+
:type return_errors: bool
|
|
671
|
+
:param return_errors: Set to True to return the barcodes with errors as well (e.g. checksum errors); see ``Barcode.error``.
|
|
672
|
+
Default is False.
|
|
673
|
+
:rtype: list[zxingcpp.Barcode]
|
|
674
|
+
:return: a list of Barcodes, the list is empty if none is found
|
|
675
|
+
"""
|
|
676
|
+
|
|
677
|
+
class Image:
|
|
678
|
+
def __buffer__(self, flags, /):
|
|
679
|
+
"""
|
|
680
|
+
Return a buffer object that exposes the underlying memory of the object.
|
|
681
|
+
"""
|
|
682
|
+
|
|
683
|
+
def __release_buffer__(self, buffer, /):
|
|
684
|
+
"""
|
|
685
|
+
Release the buffer object that exposes the underlying memory of the object.
|
|
686
|
+
"""
|
|
687
|
+
|
|
688
|
+
@property
|
|
689
|
+
def __array_interface__(self) -> dict: ...
|
|
690
|
+
|
|
691
|
+
@property
|
|
692
|
+
def shape(self) -> tuple: ...
|
|
693
|
+
|
|
694
|
+
def create_barcode(content: object, format: BarcodeFormat, ****kwargs) -> Barcode: ...
|
|
695
|
+
|
|
696
|
+
def write_barcode_to_image(barcode: Barcode, scale: int = 1, add_hrt: bool = False, add_quiet_zones: bool = True) -> Image: ...
|
|
697
|
+
|
|
698
|
+
def write_barcode_to_svg(barcode: Barcode, scale: int = 1, add_hrt: bool = False, add_quiet_zones: bool = True) -> str: ...
|
|
699
|
+
|
|
700
|
+
class ImageView:
|
|
701
|
+
def __init__(self, buffer: Annotated[NDArray, dict(writable=False)], width: int, height: int, format: ImageFormat, row_stride: int = 0, pix_stride: int = 0) -> None: ...
|
|
702
|
+
|
|
703
|
+
def __buffer__(self, flags, /):
|
|
704
|
+
"""
|
|
705
|
+
Return a buffer object that exposes the underlying memory of the object.
|
|
706
|
+
"""
|
|
707
|
+
|
|
708
|
+
def __release_buffer__(self, buffer, /):
|
|
709
|
+
"""
|
|
710
|
+
Release the buffer object that exposes the underlying memory of the object.
|
|
711
|
+
"""
|
|
712
|
+
|
|
713
|
+
@property
|
|
714
|
+
def format(self) -> ImageFormat: ...
|
|
715
|
+
|
|
716
|
+
Bitmap: TypeAlias = Image
|
|
717
|
+
|
|
718
|
+
def write_barcode(format: BarcodeFormat, text: object, width: int = 0, height: int = 0, quiet_zone: int = -1, ec_level: int = -1) -> Image:
|
|
719
|
+
"""
|
|
720
|
+
Write (encode) a text into a barcode and return 8-bit grayscale bitmap buffer
|
|
721
|
+
|
|
722
|
+
:type format: zxing.BarcodeFormat
|
|
723
|
+
:param format: format of the barcode to create
|
|
724
|
+
:type text: str|bytes
|
|
725
|
+
:param text: the text/content of the barcode. A str is encoded as utf8 text and bytes as binary data
|
|
726
|
+
:type width: int
|
|
727
|
+
:param width: width (in pixels) of the barcode to create. If undefined (or set to 0), barcode will be
|
|
728
|
+
created with the minimum possible width
|
|
729
|
+
:type height: int
|
|
730
|
+
:param height: height (in pixels) of the barcode to create. If undefined (or set to 0), barcode will be
|
|
731
|
+
created with the minimum possible height
|
|
732
|
+
:type quiet_zone: int
|
|
733
|
+
:param quiet_zone: minimum size (in pixels) of the quiet zone around barcode. If undefined (or set to -1),
|
|
734
|
+
the minimum quiet zone of respective barcode is used.:type ec_level: int
|
|
735
|
+
:param ec_level: error correction level of the barcode (Used for Aztec, PDF417, and QRCode only).
|
|
736
|
+
:rtype: zxingcpp.Bitmap
|
|
737
|
+
"""
|