3 #include "reader_config.hpp" 5 #include "../image.hpp" 6 #include "cvb/rect.hpp" 11 #include "_detail/read_result.hpp" 12 #include "_detail/read_result_1d.hpp" 13 #include "_detail/read_result_code128.hpp" 14 #include "_detail/read_result_code39_code93.hpp" 15 #include "_detail/read_result_data_matrix.hpp" 16 #include "_detail/read_result_pdf417.hpp" 17 #include "_detail/read_result_qr.hpp" 18 #include "_detail/read_result_sony_code.hpp" 19 #include "_detail/read_result_upc_e.hpp" 50 auto baseResult =
Decode(configMap, imagePlane, aoi);
54 auto resultT = std::dynamic_pointer_cast<T>(baseResult);
72 Cvb::CExports::cvbrect_t cRect =
74 static_cast<long>(aoi.Left()),
75 static_cast<long>(aoi.Top()),
76 static_cast<long>(aoi.Right()),
77 static_cast<long>(aoi.Bottom())
79 Cvb::CExports::cvbrect_t* pCRect = (aoi !=
Rect<int>()) ? &cRect :
nullptr;
84 auto resultInfoH = Internal::DoResCallValueOut<CExports::CVC_BC_INFO>([&](CExports::CVC_BC_INFO& resultInfo_)
88 auto retVal = CVB_CALL_CAPI(CvcBcDecodeBarcode(
90 static_cast<long>(imagePlane.
Plane()),
92 static_cast<Cvb::CExports::CVC_BC_DIRECTION>(configMap->ReadoutMode()),
93 reinterpret_cast<intptr_t>(configMap->Handle()),
95 static_cast<short>(MaxNumCodeChar_),
97 static_cast<short>(
sizeof(CExports::CVC_BC_INFO))));
100 barcodeText =
Cvb::String(stdString.begin(), stdString.end());
106 auto resultSymbology = static_cast<Symbology>(resultInfoH.type);
107 auto ResultConstructor = ConfigResultMapping.at(resultSymbology);
108 auto pReadResult = ResultConstructor(resultInfoH);
109 pReadResult->text_ = barcodeText;
113 std::dynamic_pointer_cast<ReadResultDataMatrix>(pReadResult)->gradeResult_ = std::make_shared<GradeResultDataMatrix>(resultInfoH);
115 std::dynamic_pointer_cast<ReadResultQr>(pReadResult)->gradeResult_ = std::make_shared<GradeResultQr>(resultInfoH);
117 std::dynamic_pointer_cast<ReadResult1D>(pReadResult)->gradeResult_ = std::make_shared<GradeResult1D>(resultInfoH);
137 Cvb::CExports::cvbrect_t cRect =
139 static_cast<long>(aoi.Left()),
140 static_cast<long>(aoi.Top()),
141 static_cast<long>(aoi.Right()),
142 static_cast<long>(aoi.Bottom())
144 Cvb::CExports::cvbrect_t* pCRect = (aoi !=
Rect<int>()) ? &cRect :
nullptr;
149 auto resultInfoH = Internal::DoResCallValueOut<CExports::CVC_BC_INFO>([&](CExports::CVC_BC_INFO& resultInfo_)
153 auto retVal = CVB_CALL_CAPI(CvcBcTeachDottedDataMatrix(
155 static_cast<long>(imagePlane.
Plane()),
157 static_cast<Cvb::CExports::CVC_BC_DIRECTION>(configMap->ReadoutMode()),
158 reinterpret_cast<intptr_t>(configMap->Handle()),
160 static_cast<short>(MaxNumCodeChar_),
162 static_cast<short>(
sizeof(CExports::CVC_BC_INFO))));
165 barcodeText =
Cvb::String(stdString.begin(), stdString.end());
170 auto dataMatrixResult = std::make_shared<ReadResultDataMatrix>(resultInfoH);
171 dataMatrixResult->text_ = barcodeText;
172 return dataMatrixResult;
177 static const size_t MaxNumCodeChar_ = 7090;
182 static bool IsGradeable1DCode(
Symbology sym)
232 {
Cvb::Barcode::Symbology::RSS, [](Cvb::CExports::CVC_BC_INFO& handle) {
return std::make_shared<Cvb::Barcode::ReadResult1D>(handle); } },
234 {
Cvb::Barcode::Symbology::UpcE, [](Cvb::CExports::CVC_BC_INFO& handle) {
return std::make_shared<Cvb::Barcode::ReadResultUpcE>(handle); } },
238 {
Cvb::Barcode::Symbology::Qr, [](Cvb::CExports::CVC_BC_INFO& handle) {
return std::make_shared<Cvb::Barcode::ReadResultQr>(handle); } },
241 {
Cvb::Barcode::Symbology::Code39, [](Cvb::CExports::CVC_BC_INFO& handle) {
return std::make_shared<Cvb::Barcode::ReadResultCode39Code93>(handle); } },
Image plane information container.
Definition: decl_image_plane.hpp:31
The key class for reading barcodes.
Definition: reader.hpp:31
Four State Royal Mail Barcode.
std::string String
String for wide characters or unicode characters.
Definition: string.hpp:45
Micro PDF417 Matrix Code.
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:96
const Image & Parent() const noexcept
Image to which this plane descriptor refers to.
Definition: detail_image_plane.hpp:87
int Plane() const noexcept
Plane index in the image, to which this plane refers to.
Definition: decl_image_plane.hpp:169
Root namespace for the Image Manager interface.
Definition: version.hpp:11
2 of 5 Interleaved Barcode
static ReadResultDataMatrixPtr TeachDottedDataMatrix(ReaderConfigPtr configMap, const ImagePlane &imagePlane, Rect< int > aoi=Rect< int >())
Teach a dotted data matrix code into a configuration.
Definition: reader.hpp:132
void * Handle() const noexcept
Classic API image handle.
Definition: decl_image.hpp:223
static ReadResultPtr Decode(ReaderConfigPtr configMap, const ImagePlane &imagePlane, Rect< int > aoi=Rect< int >())
This function initiates the decoding of barcodes.
Definition: reader.hpp:70
Four State Australian Barcode.
static std::shared_ptr< T > Decode(ReaderConfigPtr configMap, const ImagePlane &imagePlane, Rect< int > aoi=Rect< int >())
This function initiates the decoding of barcodes and dynamically casts the result.
Definition: reader.hpp:47
std::shared_ptr< ReadResult > ReadResultPtr
Convenience shared pointer for ReadResult.
Definition: barcode.hpp:63