CVB++ 15.0
qr_grading.hpp
1#pragma once
2
3#include "../../_cexports/c_barcode.h"
4#include "grader_2d_config_base.hpp"
5
6namespace Cvb
7{
8 CVB_BEGIN_INLINE_NS
9
10 namespace Barcode
11 {
12
14
17 {
18 public:
19
21
26 void SetExpectReducedQuietzone(bool expectReducedQuietzone)
27 {
28 SetDirty();
29 expectReducedQuietzone_ = expectReducedQuietzone;
30 };
31
33
39 {
40 return expectReducedQuietzone_;
41 };
42
43
45
50 void SetGradeFormatInformation(bool formatInformation)
51 {
52 SetDirty();
53 formatInformation_ = formatInformation;
54 };
55
57
63 {
64 return formatInformation_;
65 };
66
67
69
74 void SetGradeVersionInformation(bool versionInformation)
75 {
76 SetDirty();
77 versionInformation_ = versionInformation;
78 };
79
81
87 {
88 return versionInformation_;
89 };
90
91
92 protected:
93 SmartBool expectReducedQuietzone_;
94 SmartBool formatInformation_;
95 SmartBool versionInformation_;
96
97 public:
98 virtual Symbology Type() const override { return Symbology::QrGrading; };
99
101
107 static std::unique_ptr<QrGrading> FromHandle(const HandleGuard<ReaderConfig>& guard, bool& isActiveOut)
108 {
109 auto pConfig = std::unique_ptr<QrGrading>(new QrGrading());
110 isActiveOut = pConfig->ReadFromHandle(guard);
111 return pConfig;
112 }
113
114 protected:
115 virtual bool ReadFromHandle_(const HandleGuard<ReaderConfig>& guard) override
116 {
117 short rMin, rMax;
118 CExports::cvbbool_t active;
119 CVB_CALL_CAPI(CvcBcGetQRCodeGradingEx(
120 reinterpret_cast<std::intptr_t>(guard.Handle()), &active,
121 symbolContrast_.Ptr(),
122 axialNonUniformity_.Ptr(),
123 gridNonUniformity_.Ptr(),
124 unusedErrorCorrection_.Ptr(),
125 angleOfDistortion_.Ptr(),
126 modulation_.Ptr(),
127 reflectanceMargin_.Ptr(),
128 fixedPatternDamage_.Ptr(),
129 formatInformation_.Ptr(),
130 versionInformation_.Ptr(),
131 expectReducedQuietzone_.Ptr(),
132 &rMin,
133 &rMax
134 ));
135 reflectanceReference_ = Cvb::ValueRange<int>(rMin, rMax);
136
137 return SmartBool(active);
138 }
139
140 virtual void WriteToHandle_(bool active, HandleGuard<ReaderConfig>& guard) override
141 {
142 Internal::DoResCall([&]()
143 {
144 return CVB_CALL_CAPI(CvcBcSetQRCodeGradingEx(reinterpret_cast<intptr_t>(guard.Handle()),
145 SmartBool(active),
146 symbolContrast_,
147 axialNonUniformity_,
148 gridNonUniformity_,
149 unusedErrorCorrection_,
150 angleOfDistortion_,
151 modulation_,
152 reflectanceMargin_,
153 fixedPatternDamage_,
154 formatInformation_,
155 versionInformation_,
156 expectReducedQuietzone_,
157 static_cast<short>(reflectanceReference_.Min()),
158 static_cast<short>(reflectanceReference_.Max())));
159 });
160 }
161
162 QrGrading()
163 : Grader2DConfigBase()
164 {
165 }
166
167
168 };
169
170 using QrGradingPtr = std::shared_ptr<QrGrading>;
171 }
172
173 CVB_END_INLINE_NS
174}
Configuration to access parameters of Grader2DConfigBase.
Definition: grader_2d_config_base.hpp:19
Configuration to access parameters of QrGrading.
Definition: qr_grading.hpp:17
void SetGradeFormatInformation(bool formatInformation)
Activates (true) or deactivates (false) the calculation of the format information grade.
Definition: qr_grading.hpp:50
static std::unique_ptr< QrGrading > FromHandle(const HandleGuard< ReaderConfig > &guard, bool &isActiveOut)
Create object from handle.
Definition: qr_grading.hpp:107
void SetExpectReducedQuietzone(bool expectReducedQuietzone)
With this flag the quiet zone expected may be reduced to one module size (standard are 4 module sizes...
Definition: qr_grading.hpp:26
void SetGradeVersionInformation(bool versionInformation)
Activates (true) or deactivates (false) the calculation of the version information grade.
Definition: qr_grading.hpp:74
bool GradeFormatInformation() const
Returns the calculation of the format information grade.
Definition: qr_grading.hpp:62
bool GradeVersionInformation() const
Returns the calculation of the version information grade.
Definition: qr_grading.hpp:86
bool ExpectReducedQuietzone() const
Returns whether the quiet zone expected may be reduced to one module size (standard are 4 module size...
Definition: qr_grading.hpp:38
T Min() const noexcept
Gets the minimum value.
Definition: value_range.hpp:50
T Max() const noexcept
Gets the maximum value.
Definition: value_range.hpp:72
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:97
@ QrGrading
QR code grading.
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24