IDS peak IPL v1.16.0
Loading...
Searching...
No Matches
peak_ipl_gamma_corrector.hpp
Go to the documentation of this file.
1
10
11#pragma once
12
18
22namespace peak
23{
24namespace ipl
25{
26
27class Image;
28
32class GammaCorrector final
33{
34public:
42
50
62 GammaCorrector(const GammaCorrector& other);
63
76
85 GammaCorrector(GammaCorrector&& other) noexcept;
86
95 GammaCorrector& operator=(GammaCorrector&& other) noexcept;
96
114 void SetGammaCorrectionValue(float gammaValue);
115
124
133
142
165 void SetDigitalBlack(float digitalBlackValue);
166
174 PEAK_IPL_NO_DISCARD float DigitalBlack() const;
175
185
195
206
218 void ProcessInPlace(Image& image) const;
219
232 PEAK_IPL_NO_DISCARD Image Process(const Image& inputImage) const;
233
234private:
235 PEAK_IPL_GAMMA_CORRECTOR_HANDLE m_backendHandle{};
236};
237
242
244{
245 if (m_backendHandle)
246 {
248 }
249}
250
252{
253 *this = std::move(other);
254}
255
257{
258
259
260 if (other.m_backendHandle)
261 {
263 }
264
265 m_backendHandle = other.m_backendHandle;
266}
267
269{
270 if (this != &other)
271 {
272 if (m_backendHandle)
273 {
275 }
276
277 if (other.m_backendHandle)
278 {
280 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_GammaCorrector_Acquire(other.m_backendHandle); });
281 }
282 }
283
284 m_backendHandle = other.m_backendHandle;
285
286 return *this;
287}
288
290{
291 if (this != &other)
292 {
293 if (m_backendHandle != nullptr)
294 {
296 }
297 m_backendHandle = other.m_backendHandle;
298 other.m_backendHandle = nullptr;
299 }
300
301 return *this;
302}
303
304inline void GammaCorrector::SetGammaCorrectionValue(float gammaValue)
305{
308 m_backendHandle, reinterpret_cast<float*>(&gammaValue));
309 });
310}
311
313{
314 float gammaValue;
315
318 m_backendHandle, reinterpret_cast<float*>(&gammaValue));
319 });
320
321 return gammaValue;
322}
323
325{
326 float gammaMin;
327
330 m_backendHandle, reinterpret_cast<float*>(&gammaMin));
331 });
332
333 return gammaMin;
334}
335
337{
338 float gammaMax;
339
342 m_backendHandle, reinterpret_cast<float*>(&gammaMax));
343 });
344
345 return gammaMax;
346}
347
348inline void GammaCorrector::SetDigitalBlack(float digitalBlackValue)
349{
352 m_backendHandle, reinterpret_cast<float*>(&digitalBlackValue));
353 });
354}
355
357{
358 float digitalBlackValue;
359
362 m_backendHandle, reinterpret_cast<float*>(&digitalBlackValue));
363 });
364
365 return digitalBlackValue;
366}
367
369{
370 float digitalBlackMin;
371
374 m_backendHandle, reinterpret_cast<float*>(&digitalBlackMin));
375 });
376
377 return digitalBlackMin;
378}
379
381{
382 float digitalBlackMax;
383
386 m_backendHandle, reinterpret_cast<float*>(&digitalBlackMax));
387 });
388
389 return digitalBlackMax;
390}
391
393{
394 PEAK_IPL_BOOL8 isPixelFormatSupported = 0;
395
398 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormatName),
399 reinterpret_cast<PEAK_IPL_BOOL8*>(&isPixelFormatSupported));
400 });
401
402 return isPixelFormatSupported > 0;
403}
404
405inline void GammaCorrector::ProcessInPlace(Image& image) const
406{
409 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
410 });
411}
412
413inline Image GammaCorrector::Process(const Image& inputImage) const
414{
415 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
418 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
419 });
420
421 return ImageBackendAccessor::CreateImage(outputImageHandle);
422}
423
424} /* namespace ipl */
425} /* namespace peak */
GammaCorrector & operator=(const GammaCorrector &other)
Copy assigment for GammaCorrector instance.
Definition peak_ipl_gamma_corrector.hpp:268
~GammaCorrector()
Destructor for the GammaCorrector instance.
Definition peak_ipl_gamma_corrector.hpp:243
float GammaCorrectionMin() const
Returns the minimum value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:324
float DigitalBlackMax() const
Returns the maximum value of the digital black correction.
Definition peak_ipl_gamma_corrector.hpp:380
Image Process(const Image &inputImage) const
Corrects the gammas of the given image.
Definition peak_ipl_gamma_corrector.hpp:413
float GammaCorrectionValue() const
Returns the value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:312
float DigitalBlack() const
Returns the value of the digital black correction.
Definition peak_ipl_gamma_corrector.hpp:356
void SetGammaCorrectionValue(float gammaValue)
Sets the gamma value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:304
float GammaCorrectionMax() const
Returns the maximum value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:336
void SetDigitalBlack(float digitalBlackValue)
Configures the digital black correction value to adjust RGB master black.
Definition peak_ipl_gamma_corrector.hpp:348
bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const
Returns whether the gamma corrector supports the given pixel format.
Definition peak_ipl_gamma_corrector.hpp:392
GammaCorrector()
Constructor for a new GammaCorrector instance.
Definition peak_ipl_gamma_corrector.hpp:238
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:405
float DigitalBlackMin() const
Returns the minimum value of the digital black correction.
Definition peak_ipl_gamma_corrector.hpp:368
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:41
Definition peak_ipl_binning.hpp:25
PixelFormatName
Enum holding the possible pixel format names.
Definition peak_ipl_simple_types.hpp:39
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition peak_ipl_exception.hpp:182
The "peak::ipl" namespace contains the whole image processing library.
Definition peak_ipl_binning.hpp:23
#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