IDS peak ICV v1.2.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
51{
52public:
61
65 void SetEnabled(bool enabled) override;
66
70 PEAK_COMMON_NO_DISCARD bool IsEnabled() const override;
71
79 void ResetToDefault() override;
80
92 void SetX(uint32_t x);
93
105 void SetY(uint32_t y);
106
115 PEAK_COMMON_NO_DISCARD uint32_t GetX() const;
116
125 PEAK_COMMON_NO_DISCARD uint32_t GetY() const;
126
136 PEAK_COMMON_NO_DISCARD peak::common::IntervalU GetRange() const;
137
138private:
140};
141
143 : m_module(module)
144{}
145
146inline void DecimationFeature::SetEnabled(bool enabled)
147{
148 m_module.SetEnabled(enabled);
149}
150
152{
153 return m_module.IsEnabled();
154}
155
157{
158 m_module.ResetToDefault();
159}
160
161inline void DecimationFeature::SetX(uint32_t x)
162{
163 try
164 {
165 m_module.SetX(x);
166 }
167 catch (const peak::icv::OutOfRangeException&)
168 {
169 const auto range = m_module.GetRange();
170 throw peak::icv::OutOfRangeException("The specified decimation factor " + std::to_string(x)
171 + " is incorrect; the expected value must be between " + std::to_string(range.GetMinimum()) + " and "
172 + std::to_string(range.GetMaximum()) + ".");
173 }
174}
175
176inline void DecimationFeature::SetY(uint32_t y)
177{
178 try
179 {
180 m_module.SetY(y);
181 }
182 catch (const peak::icv::OutOfRangeException&)
183 {
184 const auto range = m_module.GetRange();
185 throw peak::icv::OutOfRangeException("The specified decimation factor " + std::to_string(y)
186 + " is incorrect; the expected value must be between " + std::to_string(range.GetMinimum()) + " and "
187 + std::to_string(range.GetMaximum()) + ".");
188 }
189}
190
191inline uint32_t DecimationFeature::GetX() const
192{
193 return m_module.GetX();
194}
195
196inline uint32_t DecimationFeature::GetY() const
197{
198 return m_module.GetY();
199}
200
202{
203 return m_module.GetRange();
204}
205
206} // namespace features
207} // namespace pipeline
208} // 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, except the CustomType.
bool IsEnabled() const override
Checks if the module is currently enabled.
Decimation is used to decrease the image size.
uint32_t GetY() const
Gets the current number of rows used for decimation.
uint32_t GetX() const
Gets 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
Gets 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.