IDS peak IPL v1.18.0
Loading...
Searching...
No Matches
peak_ipl_edge_enhancement.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
13
14#include <type_traits>
15#include <algorithm>
16#include <cstdint>
17#include <iterator>
18#include <vector>
19
24
25namespace peak
26{
27namespace ipl
28{
29class Image;
30enum class PixelFormatName;
37class EdgeEnhancement final
38{
39public:
47
55
67 EdgeEnhancement(const EdgeEnhancement& other);
68
81
90 EdgeEnhancement(EdgeEnhancement&& other) noexcept;
91
100 EdgeEnhancement& operator=(EdgeEnhancement&& other) noexcept;
101
115 inline void ProcessInPlace(Image& image) const;
116
134 PEAK_IPL_NO_DISCARD inline Image Process(const Image& image) const;
135
149 PEAK_IPL_NO_DISCARD inline bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const;
150
160 inline void SetFactor(std::uint32_t factor);
161
171 PEAK_IPL_NO_DISCARD inline std::uint32_t Factor() const;
172
182 PEAK_IPL_NO_DISCARD inline std::uint32_t DefaultFactor() const;
183
194
195private:
196 PEAK_IPL_EDGE_ENHANCEMENT_HANDLE m_backendHandle{};
197};
198
203
205{
206 if (m_backendHandle)
207 {
209 }
210}
211
213{
214 *this = std::move(other);
215}
216
218{
219 if (other.m_backendHandle)
220 {
222 }
223
224 m_backendHandle = other.m_backendHandle;
225}
226
228{
229 if (this != &other)
230 {
231 if (m_backendHandle)
232 {
234 }
235
236 if (other.m_backendHandle)
237 {
239 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_EdgeEnhancement_Acquire(other.m_backendHandle); });
240 }
241 }
242
243 m_backendHandle = other.m_backendHandle;
244
245 return *this;
246}
247
249{
250 if (this != &other)
251 {
252 if (m_backendHandle != nullptr)
253 {
255 }
256
257 m_backendHandle = other.m_backendHandle;
258 other.m_backendHandle = nullptr;
259 }
260
261 return *this;
262}
263
264inline void EdgeEnhancement::ProcessInPlace(Image& image) const
265{
268 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
269 });
270}
271
272inline Image EdgeEnhancement::Process(const Image& image) const
273{
274 PEAK_IPL_IMAGE_HANDLE handle{};
275
278 m_backendHandle, ImageBackendAccessor::BackendHandle(image), &handle);
279 });
280
281 return ImageBackendAccessor::CreateImage(handle);
282}
283
285{
286 PEAK_IPL_BOOL8 isPixelFormatSupported = 0;
287
290 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormatName), &isPixelFormatSupported);
291 });
292
293 return isPixelFormatSupported != 0;
294}
295
296inline void EdgeEnhancement::SetFactor(std::uint32_t factor)
297{
300 m_backendHandle, factor);
301 });
302}
303
304inline uint32_t EdgeEnhancement::Factor() const
305{
306 uint32_t factor{};
307
310 m_backendHandle, &factor);
311 });
312
313 return factor;
314}
315
316inline uint32_t EdgeEnhancement::DefaultFactor() const
317{
318 uint32_t factor{};
319
322 m_backendHandle, &factor);
323 });
324
325 return factor;
326}
327
329{
330 PEAK_IPL_RANGE range{};
331
334 m_backendHandle, &range);
335 });
336
337 return { range.min, range.max, range.inc };
338}
339
340} /* namespace ipl */
341} /* namespace peak */
~EdgeEnhancement()
Destructor for the EdgeEnhancement instance.
Definition peak_ipl_edge_enhancement.hpp:204
void ProcessInPlace(Image &image) const
Process an image.
Definition peak_ipl_edge_enhancement.hpp:264
EdgeEnhancement()
Constructor for a new EdgeEnhancement instance.
Definition peak_ipl_edge_enhancement.hpp:199
std::uint32_t Factor() const
Get the edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:304
std::uint32_t DefaultFactor() const
Get the default edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:316
Image Process(const Image &image) const
Process an image.
Definition peak_ipl_edge_enhancement.hpp:272
peak::ipl::Range< std::uint32_t > Range() const
Get the range for the edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:328
bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const
Check if the pixel format is supported.
Definition peak_ipl_edge_enhancement.hpp:284
void SetFactor(std::uint32_t factor)
Set the edge enhancement factor.
Definition peak_ipl_edge_enhancement.hpp:296
EdgeEnhancement & operator=(const EdgeEnhancement &other)
Copy assigment for EdgeEnhancement instance.
Definition peak_ipl_edge_enhancement.hpp:227
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:42
Range support and convenience class.
Definition peak_ipl_range.hpp:30
PixelFormatName
Enum holding the possible pixel format names.
Definition peak_ipl_simple_types.hpp:38
The "peak::ipl" namespace contains the whole image processing library.
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition peak_ipl_exception.hpp:284
#define PEAK_IPL_NO_DISCARD
Definition peak_ipl_attribute_defines.h:20
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:402
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:23
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:170
struct PEAK_IPL_EDGE_ENHANCEMENT * PEAK_IPL_EDGE_ENHANCEMENT_HANDLE
Definition peak_ipl_backend.h:422
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:11
Definition peak_ipl_backend.h:311
uint32_t min
Definition peak_ipl_backend.h:312
uint32_t inc
Definition peak_ipl_backend.h:314
uint32_t max
Definition peak_ipl_backend.h:313