IDS peak IPL v1.13.0
Loading...
Searching...
No Matches
peak_ipl_edge_enhancement.hpp
Go to the documentation of this file.
1
11#pragma once
12
18
19#include <type_traits>
20#include <algorithm>
21#include <cstdint>
22#include <iterator>
23#include <vector>
24
28namespace peak
29{
30namespace ipl
31{
32class Image;
33enum class PixelFormatName;
39class EdgeEnhancement final
40{
41public:
49
57
69 EdgeEnhancement(const EdgeEnhancement& other);
70
83
92 EdgeEnhancement(EdgeEnhancement&& other) noexcept;
93
102 EdgeEnhancement& operator=(EdgeEnhancement&& other) noexcept;
103
117 inline void ProcessInPlace(Image& image) const;
118
136 PEAK_IPL_NO_DISCARD inline Image Process(const Image& image) const;
137
151 PEAK_IPL_NO_DISCARD inline bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const;
152
162 inline void SetFactor(std::uint32_t factor);
163
173 PEAK_IPL_NO_DISCARD inline std::uint32_t Factor() const;
174
184 PEAK_IPL_NO_DISCARD inline std::uint32_t DefaultFactor() const;
185
196
197private:
198 PEAK_IPL_EDGE_ENHANCEMENT_HANDLE m_backendHandle{};
199};
200
205
207{
208 if (m_backendHandle)
209 {
211 }
212}
213
215{
216 *this = std::move(other);
217}
218
220{
221 if (other.m_backendHandle)
222 {
224 }
225
226 m_backendHandle = other.m_backendHandle;
227}
228
230{
231 if (this != &other)
232 {
233 if (m_backendHandle)
234 {
236 }
237
238 if (other.m_backendHandle)
239 {
241 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_EdgeEnhancement_Acquire(other.m_backendHandle); });
242 }
243 }
244
245 m_backendHandle = other.m_backendHandle;
246
247 return *this;
248}
249
251{
252 if (this != &other)
253 {
254 if (m_backendHandle != nullptr)
255 {
257 }
258
259 m_backendHandle = other.m_backendHandle;
260 other.m_backendHandle = nullptr;
261 }
262
263 return *this;
264}
265
266inline void EdgeEnhancement::ProcessInPlace(Image& image) const
267{
270 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
271 });
272}
273
274inline Image EdgeEnhancement::Process(const Image& image) const
275{
276 PEAK_IPL_IMAGE_HANDLE handle{};
277
280 m_backendHandle, ImageBackendAccessor::BackendHandle(image), &handle);
281 });
282
283 return ImageBackendAccessor::CreateImage(handle);
284}
285
287{
288 PEAK_IPL_BOOL8 isPixelFormatSupported = 0;
289
292 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormatName), &isPixelFormatSupported);
293 });
294
295 return isPixelFormatSupported != 0;
296}
297
298inline void EdgeEnhancement::SetFactor(std::uint32_t factor)
299{
302 m_backendHandle, factor);
303 });
304}
305
306inline uint32_t EdgeEnhancement::Factor() const
307{
308 uint32_t factor{};
309
312 m_backendHandle, &factor);
313 });
314
315 return factor;
316}
317
318inline uint32_t EdgeEnhancement::DefaultFactor() const
319{
320 uint32_t factor{};
321
324 m_backendHandle, &factor);
325 });
326
327 return factor;
328}
329
331{
332 PEAK_IPL_RANGE range{};
333
336 m_backendHandle, &range);
337 });
338
339 return { range.min, range.max, range.inc };
340}
341
342} /* namespace ipl */
343} /* namespace peak */
Edge Enhancement for a given image.
Definition peak_ipl_edge_enhancement.hpp:40
~EdgeEnhancement()
Destructor for the EdgeEnhancement instance.
Definition peak_ipl_edge_enhancement.hpp:206
void ProcessInPlace(Image &image) const
Process an image.
Definition peak_ipl_edge_enhancement.hpp:266
EdgeEnhancement()
Constructor for a new EdgeEnhancement instance.
Definition peak_ipl_edge_enhancement.hpp:201
std::uint32_t Factor() const
Get the edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:306
std::uint32_t DefaultFactor() const
Get the default edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:318
Image Process(const Image &image) const
Process an image.
Definition peak_ipl_edge_enhancement.hpp:274
peak::ipl::Range< std::uint32_t > Range() const
Get the range for the edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:330
bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const
Check if the pixel format is supported.
Definition peak_ipl_edge_enhancement.hpp:286
void SetFactor(std::uint32_t factor)
Set the edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:298
EdgeEnhancement & operator=(const EdgeEnhancement &other)
Copy assigment for EdgeEnhancement instance.
Definition peak_ipl_edge_enhancement.hpp:229
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:40
Range support and convenience class.
Definition peak_ipl_range.hpp:31
PixelFormatName
Enum holding the possible pixel format names.
Definition peak_ipl_simple_types.hpp:39
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition peak_ipl_exception.hpp:182
The "peak::ipl" namespace contains the whole image processing library.
Definition peak_ipl_binning.hpp:23
PEAK_IPL_C_API PEAK_IPL_EdgeEnhancement_GetDefaultFactor(PEAK_IPL_EDGE_ENHANCEMENT_HANDLE handle, uint32_t *factor)
Get the default factor for edge enhancement.
PEAK_IPL_C_API PEAK_IPL_EdgeEnhancement_ProcessInPlace(PEAK_IPL_EDGE_ENHANCEMENT_HANDLE handle, PEAK_IPL_IMAGE_HANDLE imageHandle)
Process the given image with edge enhancement.
PEAK_IPL_C_API PEAK_IPL_EdgeEnhancement_Acquire(PEAK_IPL_EDGE_ENHANCEMENT_HANDLE handle)
Increase the reference count of an edge enhancement object.
PEAK_IPL_C_API PEAK_IPL_EdgeEnhancement_GetFactor(PEAK_IPL_EDGE_ENHANCEMENT_HANDLE handle, uint32_t *factor)
Get the factor for edge enhancement.
struct PEAK_IPL_IMAGE * PEAK_IPL_IMAGE_HANDLE
Definition peak_ipl_backend.h:369
PEAK_IPL_C_API PEAK_IPL_EdgeEnhancement_GetFactorRange(PEAK_IPL_EDGE_ENHANCEMENT_HANDLE handle, struct PEAK_IPL_RANGE *range)
Get the range of valid factors for edge enhancement.
int8_t PEAK_IPL_BOOL8
Definition peak_ipl_backend.h:41
PEAK_IPL_C_API PEAK_IPL_EdgeEnhancement_IsPixelFormatSupported(PEAK_IPL_EDGE_ENHANCEMENT_HANDLE handle, PEAK_IPL_PIXEL_FORMAT pixelFormat, PEAK_IPL_BOOL8 *isPixelFormatSupported)
Asks the given edge enhancement whether it supports the given pixel format.
PEAK_IPL_C_API PEAK_IPL_EdgeEnhancement_SetFactor(PEAK_IPL_EDGE_ENHANCEMENT_HANDLE handle, uint32_t factor)
Set the factor for edge enhancement.
#define PEAK_IPL_NO_DISCARD
Definition peak_ipl_backend.h:26
int32_t PEAK_IPL_PIXEL_FORMAT
Definition peak_ipl_backend.h:188
struct PEAK_IPL_EDGE_ENHANCEMENT * PEAK_IPL_EDGE_ENHANCEMENT_HANDLE
Definition peak_ipl_backend.h:389
PEAK_IPL_C_API PEAK_IPL_EdgeEnhancement_Construct(PEAK_IPL_EDGE_ENHANCEMENT_HANDLE *handle)
Create the edge enhancement associated with the given handle.
PEAK_IPL_C_API PEAK_IPL_EdgeEnhancement_Process(PEAK_IPL_EDGE_ENHANCEMENT_HANDLE handle, PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Process the given image with edge enhancement.
PEAK_IPL_C_API PEAK_IPL_EdgeEnhancement_Destruct(PEAK_IPL_EDGE_ENHANCEMENT_HANDLE handle)
Destruct the edge enhancement associated with the given handle.
#define PEAK_IPL_C_ABI_PREFIX
Definition peak_ipl_dll_defines.h:16
Definition peak_ipl_backend.h:329
uint32_t min
Definition peak_ipl_backend.h:330