5#include "../../shims/stdoptional.hpp"
7#include "../../global.hpp"
8#include "../../image.hpp"
9#include "../../rect.hpp"
11#include "../../_cexports/c_code_reader.h"
12#include "decl_config.hpp"
13#include "../result.hpp"
20 inline HandleGuard<CodeReader::Decoder>::HandleGuard(
void *handle) noexcept
21 : HandleGuard<CodeReader::Decoder>(handle, [](
void *handle) { CVB_CALL_CAPI(
ReleaseObject(handle)); })
49 None = CExports::CVCRCustomPerformance::CVCRCP_None,
59 Robust = CExports::CVCRCustomPerformance::CVCRCP_Robust,
118 friend class ConfigBase;
121 enum class Properties
123 BasicInkjet = CExports::CVCRPerformanceProperties::CVCRPP_BasicInkjet,
124 CodeSearchSpeed = CExports::CVCRPerformanceProperties::CVCRPP_CodeSearchSpeed,
125 TimeLimitDecode = CExports::CVCRPerformanceProperties::CVCRPP_TimeLimitDecode
128 enum class ResultProperties
130 Corners = CExports::CVCRResultProperties::CVCRRP_Corners,
131 Center = CExports::CVCRResultProperties::CVCRRP_Center,
132 SymbolType = CExports::CVCRResultProperties::CVCRRP_SymbolType,
133 SymbolTypeEx = CExports::CVCRResultProperties::CVCRRP_SymbolTypeEx,
134 Length = CExports::CVCRResultProperties::CVCRRP_Length,
135 String = CExports::CVCRResultProperties::CVCRRP_String,
136 Quality = CExports::CVCRResultProperties::CVCRRP_Quality,
137 Status = CExports::CVCRResultProperties::CVCRRP_Status,
140 ECCError = CExports::CVCRResultProperties2D::CVCRRP2D_ECCError,
141 ECCErasure = CExports::CVCRResultProperties2D::CVCRRP2D_ECCErasure,
142 SymbolHeightWidth = CExports::CVCRResultProperties2D::CVCRRP2D_SymbolHeightWidth,
143 SymbolRowsColumns = CExports::CVCRResultProperties2D::CVCRRP2D_SymbolRowsColumns
218 template <
class Rep,
class Period>
222 SetTimeLimitDecode(timeSpan);
224 auto pResult = Internal::DoResCallObjectOut<ResultHandle>([&](
void *&handle) {
225 return CVB_CALL_CAPI(CVCRDecodeMultiImageParallelizableRect(Handle(), plane.
Handle(), 0, aoi.
Left(),
229 return std::make_tuple(pResult->CreateResultVector(), pResult->IsTimeLimitReached());
252 template <
class Rep,
class Period>
256 const auto aoi =
Rect<int>(0, 0, size.Width() - 1, size.Height() - 1);
282 template <Symbology SYM>
283 typename Config::Mapper<SYM>::Type &
Config()
285 return std::get<typename Config::Mapper<SYM>::Type>(config_);
364 template <
class Rep,
class Period>
370 CVB_CALL_CAPI_CHECKED(CVCRSetPropertyInt(
371 Handle(),
static_cast<int>(CExports::CVCRPerformanceProperties::CVCRPP_TimeLimitDecode),
376 Decoder(
const Decoder &other) =
delete;
377 Decoder &operator=(
const Decoder &other) =
delete;
378 explicit Decoder(HandleGuard<Decoder> &&guard, PrivateTag) noexcept
380 , config_(
std::make_tuple(Config::DataMatrix(*
this), Config::QR(*
this), Config::MicroQR(*
this),
381 Config::Pdf417(*
this), Config::MicroPdf417(*
this), Config::GS1DataBar14(*
this),
382 Config::GS1DataBarStacked(*
this), Config::GS1DataBarLimited(*
this),
383 Config::GS1DataBarExpanded(*
this), Config::GS1DataBarExpandedStacked(*
this),
384 Config::Ean8(*
this), Config::Ean13(*
this), Config::UpcA(*
this), Config::UpcE(*
this),
385 Config::Code128(*
this), Config::Code39(*
this), Config::Code93(*
this),
386 Config::Interleaved2of5(*
this), Config::UspsIntelligentMail(*
this),
387 Config::DutchPost(*
this), Config::AustraliaPost(*
this), Config::RoyalMail(*
this),
388 Config::Pharmacode(*
this), Config::Code32(*
this), Config::Code11(*
this)))
391 virtual ~Decoder() =
default;
393 static std::unique_ptr<Decoder> FromHandle(HandleGuard<Decoder> &&guard);
395 void *Handle() const noexcept
397 return handle_.Handle();
401 HandleGuard<Decoder> handle_;
402 std::tuple<Config::DataMatrix, Config::QR, Config::MicroQR, Config::Pdf417, Config::MicroPdf417,
403 Config::GS1DataBar14, Config::GS1DataBarStacked, Config::GS1DataBarLimited, Config::GS1DataBarExpanded,
404 Config::GS1DataBarExpandedStacked, Config::Ean8, Config::Ean13, Config::UpcA, Config::UpcE,
405 Config::Code128, Config::Code39, Config::Code93, Config::Interleaved2of5, Config::UspsIntelligentMail,
406 Config::DutchPost, Config::AustraliaPost, Config::RoyalMail, Config::Pharmacode, Config::Code32,
Class for decoding.
Definition decl_decoder.hpp:116
void SetCodeSearchSpeed(int value)
Sets the code search speed.
Definition detail_decoder.hpp:73
void SetDetectorDensity(int value)
Sets the detector density to control the search aggressiveness for small codes.
Definition detail_decoder.hpp:55
CodeReader::CustomPerformance CustomPerformance() const
Retrieves the custom image processing method used to optimize decoding robustness and performance.
Definition detail_decoder.hpp:47
TimeLimitedDecoderResult ExecuteFor(const ImagePlane &plane, const Rect< int > &aoi, const std::chrono::duration< Rep, Period > &timeSpan)
Performs the decoding within a specified time limit.
Definition decl_decoder.hpp:219
bool IsBasicInkjetDPMEnabled() const
Checks whether the Basic Inkjet DPM mode is enabled.
Definition detail_decoder.hpp:33
int CodeSearchSpeed() const
Retrieves the code search speed.
Definition detail_decoder.hpp:83
TimeLimitedDecoderResult ExecuteFor(const ImagePlane &plane, const std::chrono::duration< Rep, Period > &timeSpan)
Performs the decoding within a specified time limit.
Definition decl_decoder.hpp:253
int DetectorDensity() const
Retrieves the detector density to control the search aggressiveness for small codes.
Definition detail_decoder.hpp:65
Config::Mapper< SYM >::Type & Config()
Retrieves the configuration object for a specific symbology.
Definition decl_decoder.hpp:283
std::vector< Result > Execute(const ImagePlane &plane, const Rect< int > &aoi)
Performs the decoding.
Definition detail_decoder.hpp:109
static std::unique_ptr< Decoder > Create()
Creates and returns a new Decoder instance.
Definition detail_decoder.hpp:21
void SetCustomPerformance(CustomPerformance value)
Sets the custom image processing method used to optimize decoding robustness and performance.
Definition detail_decoder.hpp:40
void SetBasicInkjetDPMEnabled(bool value)
Enables or disables the reading of Basic Inkjet DPM (Direct Part Marking) codes.
Definition detail_decoder.hpp:27
Size2D< int > Size() const noexcept
Size of the image in pixels.
Definition decl_image.hpp:428
Image plane information container.
Definition decl_image_plane.hpp:29
void * Handle() const noexcept override
Classic API image handle.
Definition detail_image_plane.hpp:35
const Image & Parent() const noexcept
Image to which this plane descriptor refers to.
Definition detail_image_plane.hpp:87
Rectangle object.
Definition rect.hpp:24
T Bottom() const noexcept
Gets bottom row of the rectangle (still inside the rectangle).
Definition rect.hpp:144
T Top() const noexcept
Gets first row of the rectangle.
Definition rect.hpp:104
T Right() const noexcept
Gets rightmost column of the rectangle (still inside the rectangle).
Definition rect.hpp:124
T Left() const noexcept
Gets first column of the rectangle.
Definition rect.hpp:84
T duration_cast(T... args)
cvbbool_t ReleaseObject(OBJ &Object)
Namespace for all decoding functionalities.
Definition decl_config_2d_codes.hpp:10
CustomPerformance
Enum class specifying custom image processing methods to improve decoding robustness and performance.
Definition decl_decoder.hpp:47
@ ExtendedRange2D
Extends the readable range for 2D codes in the central area of the image.
Definition decl_decoder.hpp:67
@ None
No additional processing is applied.
Definition decl_decoder.hpp:49
@ Robust
Enables robust decoding for a single code.
Definition decl_decoder.hpp:59
TimeLimitStatus
Enum class specifying decoder status returned by function Cvb::CodeReader::Decoder::ExecuteFor.
Definition decl_decoder.hpp:31
@ TimeLimitReached
Specified time limit for decoding reached. Decoding aborted.
Definition decl_decoder.hpp:35
@ InTime
Decoding sucessfully finished.
Definition decl_decoder.hpp:33
std::tuple< std::vector< Result >, TimeLimitStatus > TimeLimitedDecoderResult
Definition decl_decoder.hpp:40
Root namespace for the Image Manager interface.
Definition version.hpp:11