IDS peak IPL v1.17.0
Loading...
Searching...
No Matches
peak_ipl_gamma_corrector.hpp
Go to the documentation of this file.
1
10
11#pragma once
12
18
23
24namespace peak
25{
26namespace ipl
27{
28
29class Image;
30
34class GammaCorrector final
35{
36public:
44
52
64 GammaCorrector(const GammaCorrector& other);
65
78
87 GammaCorrector(GammaCorrector&& other) noexcept;
88
97 GammaCorrector& operator=(GammaCorrector&& other) noexcept;
98
116 void SetGammaCorrectionValue(float gammaValue);
117
126
135
144
167 void SetDigitalBlack(float digitalBlackValue);
168
176 PEAK_IPL_NO_DISCARD float DigitalBlack() const;
177
187
197
208
220 void ProcessInPlace(Image& image) const;
221
234 PEAK_IPL_NO_DISCARD Image Process(const Image& inputImage) const;
235
236private:
237 PEAK_IPL_GAMMA_CORRECTOR_HANDLE m_backendHandle{};
238};
239
244
246{
247 if (m_backendHandle)
248 {
250 }
251}
252
254{
255 *this = std::move(other);
256}
257
259{
260
261
262 if (other.m_backendHandle)
263 {
265 }
266
267 m_backendHandle = other.m_backendHandle;
268}
269
271{
272 if (this != &other)
273 {
274 if (m_backendHandle)
275 {
277 }
278
279 if (other.m_backendHandle)
280 {
282 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_GammaCorrector_Acquire(other.m_backendHandle); });
283 }
284 }
285
286 m_backendHandle = other.m_backendHandle;
287
288 return *this;
289}
290
292{
293 if (this != &other)
294 {
295 if (m_backendHandle != nullptr)
296 {
298 }
299 m_backendHandle = other.m_backendHandle;
300 other.m_backendHandle = nullptr;
301 }
302
303 return *this;
304}
305
306inline void GammaCorrector::SetGammaCorrectionValue(float gammaValue)
307{
310 m_backendHandle, reinterpret_cast<float*>(&gammaValue));
311 });
312}
313
315{
316 float gammaValue;
317
320 m_backendHandle, reinterpret_cast<float*>(&gammaValue));
321 });
322
323 return gammaValue;
324}
325
327{
328 float gammaMin;
329
332 m_backendHandle, reinterpret_cast<float*>(&gammaMin));
333 });
334
335 return gammaMin;
336}
337
339{
340 float gammaMax;
341
344 m_backendHandle, reinterpret_cast<float*>(&gammaMax));
345 });
346
347 return gammaMax;
348}
349
350inline void GammaCorrector::SetDigitalBlack(float digitalBlackValue)
351{
354 m_backendHandle, reinterpret_cast<float*>(&digitalBlackValue));
355 });
356}
357
359{
360 float digitalBlackValue;
361
364 m_backendHandle, reinterpret_cast<float*>(&digitalBlackValue));
365 });
366
367 return digitalBlackValue;
368}
369
371{
372 float digitalBlackMin;
373
376 m_backendHandle, reinterpret_cast<float*>(&digitalBlackMin));
377 });
378
379 return digitalBlackMin;
380}
381
383{
384 float digitalBlackMax;
385
388 m_backendHandle, reinterpret_cast<float*>(&digitalBlackMax));
389 });
390
391 return digitalBlackMax;
392}
393
395{
396 PEAK_IPL_BOOL8 isPixelFormatSupported = 0;
397
400 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormatName),
401 reinterpret_cast<PEAK_IPL_BOOL8*>(&isPixelFormatSupported));
402 });
403
404 return isPixelFormatSupported > 0;
405}
406
407inline void GammaCorrector::ProcessInPlace(Image& image) const
408{
411 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
412 });
413}
414
415inline Image GammaCorrector::Process(const Image& inputImage) const
416{
417 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
420 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
421 });
422
423 return ImageBackendAccessor::CreateImage(outputImageHandle);
424}
425
426} /* namespace ipl */
427} /* namespace peak */
GammaCorrector & operator=(const GammaCorrector &other)
Copy assigment for GammaCorrector instance.
Definition peak_ipl_gamma_corrector.hpp:270
~GammaCorrector()
Destructor for the GammaCorrector instance.
Definition peak_ipl_gamma_corrector.hpp:245
float GammaCorrectionMin() const
Returns the minimum value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:326
float DigitalBlackMax() const
Returns the maximum value of the digital black correction.
Definition peak_ipl_gamma_corrector.hpp:382
Image Process(const Image &inputImage) const
Corrects the gammas of the given image.
Definition peak_ipl_gamma_corrector.hpp:415
float GammaCorrectionValue() const
Returns the value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:314
float DigitalBlack() const
Returns the value of the digital black correction.
Definition peak_ipl_gamma_corrector.hpp:358
void SetGammaCorrectionValue(float gammaValue)
Sets the gamma value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:306
float GammaCorrectionMax() const
Returns the maximum value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:338
void SetDigitalBlack(float digitalBlackValue)
Configures the digital black correction value to adjust RGB master black.
Definition peak_ipl_gamma_corrector.hpp:350
bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const
Returns whether the gamma corrector supports the given pixel format.
Definition peak_ipl_gamma_corrector.hpp:394
GammaCorrector()
Constructor for a new GammaCorrector instance.
Definition peak_ipl_gamma_corrector.hpp:240
void ProcessInPlace(Image &image) const
Corrects the gammas of the given image in place that is, it will change the input image.
Definition peak_ipl_gamma_corrector.hpp:407
float DigitalBlackMin() const
Returns the minimum value of the digital black correction.
Definition peak_ipl_gamma_corrector.hpp:370
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:46
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
struct PEAK_IPL_GAMMA_CORRECTOR * PEAK_IPL_GAMMA_CORRECTOR_HANDLE
Definition peak_ipl_backend.h:401
PEAK_IPL_C_API PEAK_IPL_GammaCorrector_SetGammaCorrectionValue(PEAK_IPL_GAMMA_CORRECTOR_HANDLE gammaCorrectorHandle, float *gammaValue)
Sets the value of the gamma correction.
PEAK_IPL_C_API PEAK_IPL_GammaCorrector_GetIsPixelFormatSupported(PEAK_IPL_GAMMA_CORRECTOR_HANDLE gammaCorrectorHandle, PEAK_IPL_PIXEL_FORMAT pixelFormat, PEAK_IPL_BOOL8 *isPixelFormatSupported)
Asks the given gamma corrector whether it supports the given pixel format.
PEAK_IPL_C_API PEAK_IPL_GammaCorrector_ProcessInPlace(PEAK_IPL_GAMMA_CORRECTOR_HANDLE gammaCorrectorHandle, PEAK_IPL_IMAGE_HANDLE imageHandle)
Corrects the gammas of the given image.
PEAK_IPL_C_API PEAK_IPL_GammaCorrector_GetGammaCorrectionValue(PEAK_IPL_GAMMA_CORRECTOR_HANDLE gammaCorrectorHandle, float *gammaValue)
Returns the gamma corrector value.
PEAK_IPL_C_API PEAK_IPL_GammaCorrector_Acquire(PEAK_IPL_GAMMA_CORRECTOR_HANDLE gammaCorrectorHandle)
Increase the reference count of a gamma corrector object.
PEAK_IPL_C_API PEAK_IPL_GammaCorrector_GetDigitalBlack(PEAK_IPL_GAMMA_CORRECTOR_HANDLE gammaCorrectorHandle, float *digitalBlackValue)
Returns the digital black corrector value.
struct PEAK_IPL_IMAGE * PEAK_IPL_IMAGE_HANDLE
Definition peak_ipl_backend.h:405
PEAK_IPL_C_API PEAK_IPL_GammaCorrector_Destruct(PEAK_IPL_GAMMA_CORRECTOR_HANDLE gammaCorrectorHandle)
Destroys the gamma corrector associated with the given handle.
PEAK_IPL_C_API PEAK_IPL_GammaCorrector_Construct(PEAK_IPL_GAMMA_CORRECTOR_HANDLE *gammaCorrectorHandle)
Creates a gamma corrector.
PEAK_IPL_C_API PEAK_IPL_GammaCorrector_Process(PEAK_IPL_GAMMA_CORRECTOR_HANDLE gammaCorrectorHandle, PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Corrects the gammas of the given image.
PEAK_IPL_C_API PEAK_IPL_GammaCorrector_GetGammaCorrectionMax(PEAK_IPL_GAMMA_CORRECTOR_HANDLE gammaCorrectorHandle, float *gammaMax)
Returns the maximum gamma corrector value which can be set.
int8_t PEAK_IPL_BOOL8
Definition peak_ipl_backend.h:26
PEAK_IPL_C_API PEAK_IPL_GammaCorrector_GetDigitalBlackMin(PEAK_IPL_GAMMA_CORRECTOR_HANDLE gammaCorrectorHandle, float *digitalBlackMin)
Returns the minimum digital black corrector value which can be set.
int32_t PEAK_IPL_PIXEL_FORMAT
Definition peak_ipl_backend.h:173
PEAK_IPL_C_API PEAK_IPL_GammaCorrector_SetDigitalBlack(PEAK_IPL_GAMMA_CORRECTOR_HANDLE gammaCorrectorHandle, float *digitalBlackValue)
Sets the value of the digital black correction.
PEAK_IPL_C_API PEAK_IPL_GammaCorrector_GetGammaCorrectionMin(PEAK_IPL_GAMMA_CORRECTOR_HANDLE gammaCorrectorHandle, float *gammaMin)
Returns the minimum gamma corrector value which can be set.
PEAK_IPL_C_API PEAK_IPL_GammaCorrector_GetDigitalBlackMax(PEAK_IPL_GAMMA_CORRECTOR_HANDLE gammaCorrectorHandle, float *digitalBlackMax)
Returns the maximum digital black corrector value which can be set.
#define PEAK_IPL_C_ABI_PREFIX
Definition peak_ipl_dll_defines.h:16