IDS peak IPL v1.17.1
Loading...
Searching...
No Matches
peak_ipl_edge_enhancement.hpp
Go to the documentation of this file.
1
10
11#pragma once
12
18
19#include <type_traits>
20#include <algorithm>
21#include <cstdint>
22#include <iterator>
23#include <vector>
24
29
30namespace peak
31{
32namespace ipl
33{
34class Image;
35enum class PixelFormatName;
42class EdgeEnhancement final
43{
44public:
52
60
72 EdgeEnhancement(const EdgeEnhancement& other);
73
86
95 EdgeEnhancement(EdgeEnhancement&& other) noexcept;
96
105 EdgeEnhancement& operator=(EdgeEnhancement&& other) noexcept;
106
120 inline void ProcessInPlace(Image& image) const;
121
139 PEAK_IPL_NO_DISCARD inline Image Process(const Image& image) const;
140
154 PEAK_IPL_NO_DISCARD inline bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const;
155
165 inline void SetFactor(std::uint32_t factor);
166
176 PEAK_IPL_NO_DISCARD inline std::uint32_t Factor() const;
177
187 PEAK_IPL_NO_DISCARD inline std::uint32_t DefaultFactor() const;
188
199
200private:
201 PEAK_IPL_EDGE_ENHANCEMENT_HANDLE m_backendHandle{};
202};
203
208
210{
211 if (m_backendHandle)
212 {
214 }
215}
216
218{
219 *this = std::move(other);
220}
221
223{
224 if (other.m_backendHandle)
225 {
227 }
228
229 m_backendHandle = other.m_backendHandle;
230}
231
233{
234 if (this != &other)
235 {
236 if (m_backendHandle)
237 {
239 }
240
241 if (other.m_backendHandle)
242 {
244 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_EdgeEnhancement_Acquire(other.m_backendHandle); });
245 }
246 }
247
248 m_backendHandle = other.m_backendHandle;
249
250 return *this;
251}
252
254{
255 if (this != &other)
256 {
257 if (m_backendHandle != nullptr)
258 {
260 }
261
262 m_backendHandle = other.m_backendHandle;
263 other.m_backendHandle = nullptr;
264 }
265
266 return *this;
267}
268
269inline void EdgeEnhancement::ProcessInPlace(Image& image) const
270{
273 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
274 });
275}
276
277inline Image EdgeEnhancement::Process(const Image& image) const
278{
279 PEAK_IPL_IMAGE_HANDLE handle{};
280
283 m_backendHandle, ImageBackendAccessor::BackendHandle(image), &handle);
284 });
285
286 return ImageBackendAccessor::CreateImage(handle);
287}
288
290{
291 PEAK_IPL_BOOL8 isPixelFormatSupported = 0;
292
295 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormatName), &isPixelFormatSupported);
296 });
297
298 return isPixelFormatSupported != 0;
299}
300
301inline void EdgeEnhancement::SetFactor(std::uint32_t factor)
302{
305 m_backendHandle, factor);
306 });
307}
308
309inline uint32_t EdgeEnhancement::Factor() const
310{
311 uint32_t factor{};
312
315 m_backendHandle, &factor);
316 });
317
318 return factor;
319}
320
321inline uint32_t EdgeEnhancement::DefaultFactor() const
322{
323 uint32_t factor{};
324
327 m_backendHandle, &factor);
328 });
329
330 return factor;
331}
332
334{
335 PEAK_IPL_RANGE range{};
336
339 m_backendHandle, &range);
340 });
341
342 return { range.min, range.max, range.inc };
343}
344
345} /* namespace ipl */
346} /* namespace peak */
~EdgeEnhancement()
Destructor for the EdgeEnhancement instance.
Definition peak_ipl_edge_enhancement.hpp:209
void ProcessInPlace(Image &image) const
Process an image.
Definition peak_ipl_edge_enhancement.hpp:269
EdgeEnhancement()
Constructor for a new EdgeEnhancement instance.
Definition peak_ipl_edge_enhancement.hpp:204
std::uint32_t Factor() const
Get the edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:309
std::uint32_t DefaultFactor() const
Get the default edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:321
Image Process(const Image &image) const
Process an image.
Definition peak_ipl_edge_enhancement.hpp:277
peak::ipl::Range< std::uint32_t > Range() const
Get the range for the edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:333
bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const
Check if the pixel format is supported.
Definition peak_ipl_edge_enhancement.hpp:289
void SetFactor(std::uint32_t factor)
Set the edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:301
EdgeEnhancement & operator=(const EdgeEnhancement &other)
Copy assigment for EdgeEnhancement instance.
Definition peak_ipl_edge_enhancement.hpp:232
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:47
Range support and convenience class.
Definition peak_ipl_range.hpp:35
PixelFormatName
Enum holding the possible pixel format names.
Definition peak_ipl_simple_types.hpp:43
The "peak::ipl" namespace contains the whole image processing library.
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition peak_ipl_exception.hpp:289
#define PEAK_IPL_NO_DISCARD
Definition peak_ipl_attribute_defines.h:25
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:405
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:26
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.
int32_t PEAK_IPL_PIXEL_FORMAT
Definition peak_ipl_backend.h:173
struct PEAK_IPL_EDGE_ENHANCEMENT * PEAK_IPL_EDGE_ENHANCEMENT_HANDLE
Definition peak_ipl_backend.h:425
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:314
uint32_t min
Definition peak_ipl_backend.h:315
uint32_t inc
Definition peak_ipl_backend.h:317
uint32_t max
Definition peak_ipl_backend.h:316