Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/3rdparty/quirc/include/quirc_internal.h
16337 views
1
/* quirc -- QR-code recognition library
2
* Copyright (C) 2010-2012 Daniel Beer <[email protected]>
3
*
4
* Permission to use, copy, modify, and/or distribute this software for any
5
* purpose with or without fee is hereby granted, provided that the above
6
* copyright notice and this permission notice appear in all copies.
7
*
8
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
*/
16
17
#ifndef QUIRC_INTERNAL_H_
18
#define QUIRC_INTERNAL_H_
19
20
#include <quirc.h>
21
22
#define QUIRC_PIXEL_WHITE 0
23
#define QUIRC_PIXEL_BLACK 1
24
#define QUIRC_PIXEL_REGION 2
25
26
#ifndef QUIRC_MAX_REGIONS
27
#define QUIRC_MAX_REGIONS 254
28
#endif
29
#define QUIRC_MAX_CAPSTONES 32
30
#define QUIRC_MAX_GRIDS 8
31
32
#define QUIRC_PERSPECTIVE_PARAMS 8
33
34
#if QUIRC_MAX_REGIONS < UINT8_MAX
35
typedef uint8_t quirc_pixel_t;
36
#elif QUIRC_MAX_REGIONS < UINT16_MAX
37
typedef uint16_t quirc_pixel_t;
38
#else
39
#error "QUIRC_MAX_REGIONS > 65534 is not supported"
40
#endif
41
42
struct quirc_region {
43
struct quirc_point seed;
44
int count;
45
int capstone;
46
};
47
48
struct quirc_capstone {
49
int ring;
50
int stone;
51
52
struct quirc_point corners[4];
53
struct quirc_point center;
54
double c[QUIRC_PERSPECTIVE_PARAMS];
55
56
int qr_grid;
57
};
58
59
struct quirc_grid {
60
/* Capstone indices */
61
int caps[3];
62
63
/* Alignment pattern region and corner */
64
int align_region;
65
struct quirc_point align;
66
67
/* Timing pattern endpoints */
68
struct quirc_point tpep[3];
69
int hscan;
70
int vscan;
71
72
/* Grid size and perspective transform */
73
int grid_size;
74
double c[QUIRC_PERSPECTIVE_PARAMS];
75
};
76
77
struct quirc {
78
uint8_t *image;
79
quirc_pixel_t *pixels;
80
int *row_average; /* used by threshold() */
81
int w;
82
int h;
83
84
int num_regions;
85
struct quirc_region regions[QUIRC_MAX_REGIONS];
86
87
int num_capstones;
88
struct quirc_capstone capstones[QUIRC_MAX_CAPSTONES];
89
90
int num_grids;
91
struct quirc_grid grids[QUIRC_MAX_GRIDS];
92
};
93
94
/************************************************************************
95
* QR-code version information database
96
*/
97
98
#define QUIRC_MAX_VERSION 40
99
#define QUIRC_MAX_ALIGNMENT 7
100
101
struct quirc_rs_params {
102
int bs; /* Small block size */
103
int dw; /* Small data words */
104
int ns; /* Number of small blocks */
105
};
106
107
struct quirc_version_info {
108
int data_bytes;
109
int apat[QUIRC_MAX_ALIGNMENT];
110
struct quirc_rs_params ecc[4];
111
};
112
113
extern const struct quirc_version_info quirc_version_db[QUIRC_MAX_VERSION + 1];
114
115
#endif
116
117