IDS peak IPL v1.17.0
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;
41class EdgeEnhancement final
42{
43public:
51
59
71 EdgeEnhancement(const EdgeEnhancement& other);
72
85
94 EdgeEnhancement(EdgeEnhancement&& other) noexcept;
95
104 EdgeEnhancement& operator=(EdgeEnhancement&& other) noexcept;
105
119 inline void ProcessInPlace(Image& image) const;
120
138 PEAK_IPL_NO_DISCARD inline Image Process(const Image& image) const;
139
153 PEAK_IPL_NO_DISCARD inline bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const;
154
164 inline void SetFactor(std::uint32_t factor);
165
175 PEAK_IPL_NO_DISCARD inline std::uint32_t Factor() const;
176
186 PEAK_IPL_NO_DISCARD inline std::uint32_t DefaultFactor() const;
187
198
199private:
200 PEAK_IPL_EDGE_ENHANCEMENT_HANDLE m_backendHandle{};
201};
202
207
209{
210 if (m_backendHandle)
211 {
213 }
214}
215
217{
218 *this = std::move(other);
219}
220
222{
223 if (other.m_backendHandle)
224 {
226 }
227
228 m_backendHandle = other.m_backendHandle;
229}
230
232{
233 if (this != &other)
234 {
235 if (m_backendHandle)
236 {
238 }
239
240 if (other.m_backendHandle)
241 {
243 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_EdgeEnhancement_Acquire(other.m_backendHandle); });
244 }
245 }
246
247 m_backendHandle = other.m_backendHandle;
248
249 return *this;
250}
251
253{
254 if (this != &other)
255 {
256 if (m_backendHandle != nullptr)
257 {
259 }
260
261 m_backendHandle = other.m_backendHandle;
262 other.m_backendHandle = nullptr;
263 }
264
265 return *this;
266}
267
268inline void EdgeEnhancement::ProcessInPlace(Image& image) const
269{
272 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
273 });
274}
275
276inline Image EdgeEnhancement::Process(const Image& image) const
277{
278 PEAK_IPL_IMAGE_HANDLE handle{};
279
282 m_backendHandle, ImageBackendAccessor::BackendHandle(image), &handle);
283 });
284
285 return ImageBackendAccessor::CreateImage(handle);
286}
287
289{
290 PEAK_IPL_BOOL8 isPixelFormatSupported = 0;
291
294 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormatName), &isPixelFormatSupported);
295 });
296
297 return isPixelFormatSupported != 0;
298}
299
300inline void EdgeEnhancement::SetFactor(std::uint32_t factor)
301{
304 m_backendHandle, factor);
305 });
306}
307
308inline uint32_t EdgeEnhancement::Factor() const
309{
310 uint32_t factor{};
311
314 m_backendHandle, &factor);
315 });
316
317 return factor;
318}
319
320inline uint32_t EdgeEnhancement::DefaultFactor() const
321{
322 uint32_t factor{};
323
326 m_backendHandle, &factor);
327 });
328
329 return factor;
330}
331
333{
334 PEAK_IPL_RANGE range{};
335
338 m_backendHandle, &range);
339 });
340
341 return { range.min, range.max, range.inc };
342}
343
344} /* namespace ipl */
345} /* namespace peak */
~EdgeEnhancement()
Destructor for the EdgeEnhancement instance.
Definition peak_ipl_edge_enhancement.hpp:208
void ProcessInPlace(Image &image) const
Process an image.
Definition peak_ipl_edge_enhancement.hpp:268
EdgeEnhancement()
Constructor for a new EdgeEnhancement instance.
Definition peak_ipl_edge_enhancement.hpp:203
std::uint32_t Factor() const
Get the edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:308
std::uint32_t DefaultFactor() const
Get the default edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:320
Image Process(const Image &image) const
Process an image.
Definition peak_ipl_edge_enhancement.hpp:276
peak::ipl::Range< std::uint32_t > Range() const
Get the range for the edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:332
bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const
Check if the pixel format is supported.
Definition peak_ipl_edge_enhancement.hpp:288
void SetFactor(std::uint32_t factor)
Set the edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:300
EdgeEnhancement & operator=(const EdgeEnhancement &other)
Copy assigment for EdgeEnhancement instance.
Definition peak_ipl_edge_enhancement.hpp:231
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:46
Range support and convenience class.
Definition peak_ipl_range.hpp:33
The "peak::ipl" namespace contains the whole image processing library.
PixelFormatName
Enum holding the possible pixel format names.
Definition peak_ipl_simple_types.hpp:41
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition peak_ipl_exception.hpp:271
#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