IDS peak ICV v1.0.0
Loading...
Searching...
No Matches
peak_icv_decimation_feature.hpp
Go to the documentation of this file.
1
11#pragma once
12
16
17namespace peak
18{
19namespace pipeline
20{
21namespace features
22{
23
47{
48public:
57
61 void SetEnabled(bool enabled) override;
62
66 PEAK_COMMON_NO_DISCARD bool IsEnabled() const override;
67
75 void ResetToDefault() override;
76
88 void SetX(uint32_t x);
89
101 void SetY(uint32_t y);
102
111 PEAK_COMMON_NO_DISCARD uint32_t GetX() const;
112
121 PEAK_COMMON_NO_DISCARD uint32_t GetY() const;
122
133
134private:
136};
137
139 : m_module(module)
140{}
141
142inline void DecimationFeature::SetEnabled(bool enabled)
143{
144 m_module.SetEnabled(enabled);
145}
146
148{
149 return m_module.IsEnabled();
150}
151
153{
154 m_module.ResetToDefault();
155}
156
157inline void DecimationFeature::SetX(uint32_t x)
158{
159 try
160 {
161 m_module.SetX(x);
162 }
163 catch (const peak::icv::OutOfRangeException&)
164 {
165 const auto range = m_module.GetRange();
166 throw peak::icv::OutOfRangeException("The specified decimation factor " + std::to_string(x)
167 + " is incorrect; the expected value must be between " + std::to_string(range.GetMinimum()) + " and "
168 + std::to_string(range.GetMaximum()) + ".");
169 }
170}
171
172inline void DecimationFeature::SetY(uint32_t y)
173{
174 try
175 {
176 m_module.SetY(y);
177 }
178 catch (const peak::icv::OutOfRangeException&)
179 {
180 const auto range = m_module.GetRange();
181 throw peak::icv::OutOfRangeException("The specified decimation factor " + std::to_string(y)
182 + " is incorrect; the expected value must be between " + std::to_string(range.GetMinimum()) + " and "
183 + std::to_string(range.GetMaximum()) + ".");
184 }
185}
186
187inline uint32_t DecimationFeature::GetX() const
188{
189 return m_module.GetX();
190}
191
192inline uint32_t DecimationFeature::GetY() const
193{
194 return m_module.GetY();
195}
196
198{
199 return m_module.GetRange();
200}
201
202} // namespace features
203} // namespace pipeline
204} // namespace peak
Represents a continuous numeric interval with inclusive lower and upper bounds.
Thrown when a value is outside the allowed range.
Downsampling is used to decrease the image size.
uint32_t GetY() const
Returns the current number of rows used for downsampling.
uint32_t GetX() const
Returns the current number of columns used for downsampling.
void SetEnabled(bool enabled) override
Sets the enabled state of this module.
void SetY(uint32_t y)
Sets the number of rows to downsample.
void SetX(uint32_t x)
Sets the number of columns to downsample.
peak::common::IntervalU GetRange() const
Returns the valid range for downsampling factors x and y.
void ResetToDefault() override
Resets all settings to default values.
bool IsEnabled() const override
Checks if the module is currently enabled.
Decimation is used to decrease the image size.
uint32_t GetY() const
Retrieves the current number of rows used for decimation.
uint32_t GetX() const
Retrieves the current number of columns used for decimation.
void SetEnabled(bool enabled) override
Enables or disables the feature.
DecimationFeature(detail::DownsamplingModule &module)
Creates a DecimationFeature for an existing downsampling module.
void SetY(uint32_t y)
Sets the number of rows used for decimation.
void SetX(uint32_t x)
Sets the number of columns used for decimation.
peak::common::IntervalU GetRange() const
Retrieves the valid range for the decimation factors x and y.
void ResetToDefault() override
Resets all settings to the default values.
bool IsEnabled() const override
Indicates whether the feature is currently enabled.
Abstract base class for all image processing pipeline features.
#define PEAK_COMMON_NO_DISCARD
Compatability macro for the nodiscard attribute.