@@ -17,94 +17,10 @@ API stability isn't guaranteed before ``1.0.0`` version. Versioning is propagate
1717
1818When version ``1.0.0 `` will be released the API will be frozen, and any changes which aren't backwards compatible will force a major version bump.
1919
20- Usage
21- -----
22-
23- High-level API
24- ``````````````
25-
26- Just call a `quirc.decode() ` function with a `PIL.Image ` object as a parameter, like this:
27-
28- .. code-block ::
29-
30- import Image
31-
32- image = Image.open('tests/images/test1.png')
33- for code in quirc.decode(image):
34- print code['text']
35- # >>> test1
36-
37- Currently only ``PIL `` is supported.
38-
39- Low-level API
40- `````````````
41-
42- Low-level API directly corresponds to the C API:
43-
44- Create new `Quirc ` object with a `quirc.api.new ` function.
45-
46- .. code-block ::
47-
48- qr = quirc.api.new()
49-
50- Set the image size that you'll be working with
51-
52- .. code-block ::
53-
54- quirc.api.resize(qr, 640, 480)
55-
56- Processing frames is done in two stages. The first stage is an image-recognition stage called identification,
57- which takes a grayscale image and searches for QR codes.
58-
59- .. code-block ::
60-
61- buffer = quirc.api.begin(qr, 640, 480)
62-
63- Now fill out this image buffer with a pixels. One byte per pixel, w pixels per line, h lines in the buffer.
64- Here is a simplest example from the `tests/test_quirc.py:test_fill `:
65-
66- .. code-block ::
67-
68- for idx, pixel in enumerate(pixels):
69- buffer[idx] = ctypes.c_uint8(ord(pixel))
70-
71- After the call to `quirc.api.end `, the decoder holds a list of detected QR codes
72-
73- .. code-block ::
74-
75- quirc.api.end(qr)
76-
77- At this point, the second stage of processing occurs - decoding.
78-
79- Number of QR codes identified in this image
80-
81- .. code-block ::
82-
83- num_codes = quirc.api.count(obj)
84-
85- Iterate all over the identified codes
86-
87- .. code-block ::
88-
89- for i in range(num_codes):
90- # Prepare required structures for data filling
91-
92- # `quirc.api.structures.Code` structure contains information about detected QR code in the input image
93- code = quirc.api.structures.Code()
94- quirc.api.extract(qr, i, ctypes.byref(code))
95-
96- # `quirc.api.structures.Data` holds the decoded QR code data
97- data = quirc.api.structures.Data()
98- quirc.api.decode(ctypes.byref(code), ctypes.byref(data))
99-
100- # Extracting QR-encoded string now
101- print ctypes.string_at(data.payload, data.payload_len)
102-
103- Finally, release the allocated memory
104-
105- .. code-block ::
20+ Documentation
21+ -------------
10622
107- quirc.api.destroy(qr)
23+ Read the documentation and usage examples ` here < http://python- quirc.readthedocs.org >`_.
10824
10925Trobleshooting
11026--------------
0 commit comments