IDS peak IPL v1.17.2
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
35class GammaCorrector final
36{
37public:
45
53
65 GammaCorrector(const GammaCorrector& other);
66
79
88 GammaCorrector(GammaCorrector&& other) noexcept;
89
98 GammaCorrector& operator=(GammaCorrector&& other) noexcept;
99
117 void SetGammaCorrectionValue(float gammaValue);
118
127
136
145
168 void SetDigitalBlack(float digitalBlackValue);
169
177 PEAK_IPL_NO_DISCARD float DigitalBlack() const;
178
188
198
209
221 void ProcessInPlace(Image& image) const;
222
235 PEAK_IPL_NO_DISCARD Image Process(const Image& inputImage) const;
236
237private:
238 PEAK_IPL_GAMMA_CORRECTOR_HANDLE m_backendHandle{};
239};
240
245
247{
248 if (m_backendHandle)
249 {
251 }
252}
253
255{
256 *this = std::move(other);
257}
258
260{
261
262
263 if (other.m_backendHandle)
264 {
266 }
267
268 m_backendHandle = other.m_backendHandle;
269}
270
272{
273 if (this != &other)
274 {
275 if (m_backendHandle)
276 {
278 }
279
280 if (other.m_backendHandle)
281 {
283 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_GammaCorrector_Acquire(other.m_backendHandle); });
284 }
285 }
286
287 m_backendHandle = other.m_backendHandle;
288
289 return *this;
290}
291
293{
294 if (this != &other)
295 {
296 if (m_backendHandle != nullptr)
297 {
299 }
300 m_backendHandle = other.m_backendHandle;
301 other.m_backendHandle = nullptr;
302 }
303
304 return *this;
305}
306
307inline void GammaCorrector::SetGammaCorrectionValue(float gammaValue)
308{
311 m_backendHandle, reinterpret_cast<float*>(&gammaValue));
312 });
313}
314
316{
317 float gammaValue;
318
321 m_backendHandle, reinterpret_cast<float*>(&gammaValue));
322 });
323
324 return gammaValue;
325}
326
328{
329 float gammaMin;
330
333 m_backendHandle, reinterpret_cast<float*>(&gammaMin));
334 });
335
336 return gammaMin;
337}
338
340{
341 float gammaMax;
342
345 m_backendHandle, reinterpret_cast<float*>(&gammaMax));
346 });
347
348 return gammaMax;
349}
350
351inline void GammaCorrector::SetDigitalBlack(float digitalBlackValue)
352{
355 m_backendHandle, reinterpret_cast<float*>(&digitalBlackValue));
356 });
357}
358
360{
361 float digitalBlackValue;
362
365 m_backendHandle, reinterpret_cast<float*>(&digitalBlackValue));
366 });
367
368 return digitalBlackValue;
369}
370
372{
373 float digitalBlackMin;
374
377 m_backendHandle, reinterpret_cast<float*>(&digitalBlackMin));
378 });
379
380 return digitalBlackMin;
381}
382
384{
385 float digitalBlackMax;
386
389 m_backendHandle, reinterpret_cast<float*>(&digitalBlackMax));
390 });
391
392 return digitalBlackMax;
393}
394
396{
397 PEAK_IPL_BOOL8 isPixelFormatSupported = 0;
398
401 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormatName),
402 reinterpret_cast<PEAK_IPL_BOOL8*>(&isPixelFormatSupported));
403 });
404
405 return isPixelFormatSupported > 0;
406}
407
408inline void GammaCorrector::ProcessInPlace(Image& image) const
409{
412 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
413 });
414}
415
416inline Image GammaCorrector::Process(const Image& inputImage) const
417{
418 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
421 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
422 });
423
424 return ImageBackendAccessor::CreateImage(outputImageHandle);
425}
426
427} /* namespace ipl */
428} /* namespace peak */
GammaCorrector & operator=(const GammaCorrector &other)
Copy assigment for GammaCorrector instance.
Definition peak_ipl_gamma_corrector.hpp:271
~GammaCorrector()
Destructor for the GammaCorrector instance.
Definition peak_ipl_gamma_corrector.hpp:246
float GammaCorrectionMin() const
Returns the minimum value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:327
float DigitalBlackMax() const
Returns the maximum value of the digital black correction.
Definition peak_ipl_gamma_corrector.hpp:383
Image Process(const Image &inputImage) const
Corrects the gammas of the given image.
Definition peak_ipl_gamma_corrector.hpp:416
float GammaCorrectionValue() const
Returns the value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:315
float DigitalBlack() const
Returns the value of the digital black correction.
Definition peak_ipl_gamma_corrector.hpp:359
void SetGammaCorrectionValue(float gammaValue)
Sets the gamma value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:307
float GammaCorrectionMax() const
Returns the maximum value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:339
void SetDigitalBlack(float digitalBlackValue)
Configures the digital black correction value to adjust RGB master black.
Definition peak_ipl_gamma_corrector.hpp:351
bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const
Returns whether the gamma corrector supports the given pixel format.
Definition peak_ipl_gamma_corrector.hpp:395
GammaCorrector()
Constructor for a new GammaCorrector instance.
Definition peak_ipl_gamma_corrector.hpp:241
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:408
float DigitalBlackMin() const
Returns the minimum value of the digital black correction.
Definition peak_ipl_gamma_corrector.hpp:371
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:47
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
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