IDS peak IPL v1.18.0
Loading...
Searching...
No Matches
peak_ipl_gamma_corrector.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
13
18
19namespace peak
20{
21namespace ipl
22{
23
24class Image;
25
30class GammaCorrector final
31{
32public:
40
48
60 GammaCorrector(const GammaCorrector& other);
61
74
83 GammaCorrector(GammaCorrector&& other) noexcept;
84
93 GammaCorrector& operator=(GammaCorrector&& other) noexcept;
94
112 void SetGammaCorrectionValue(float gammaValue);
113
122
131
140
163 void SetDigitalBlack(float digitalBlackValue);
164
172 PEAK_IPL_NO_DISCARD float DigitalBlack() const;
173
183
193
204
216 void ProcessInPlace(Image& image) const;
217
230 PEAK_IPL_NO_DISCARD Image Process(const Image& inputImage) const;
231
232private:
233 PEAK_IPL_GAMMA_CORRECTOR_HANDLE m_backendHandle{};
234};
235
240
242{
243 if (m_backendHandle)
244 {
246 }
247}
248
250{
251 *this = std::move(other);
252}
253
255{
256
257
258 if (other.m_backendHandle)
259 {
261 }
262
263 m_backendHandle = other.m_backendHandle;
264}
265
267{
268 if (this != &other)
269 {
270 if (m_backendHandle)
271 {
273 }
274
275 if (other.m_backendHandle)
276 {
278 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_GammaCorrector_Acquire(other.m_backendHandle); });
279 }
280 }
281
282 m_backendHandle = other.m_backendHandle;
283
284 return *this;
285}
286
288{
289 if (this != &other)
290 {
291 if (m_backendHandle != nullptr)
292 {
294 }
295 m_backendHandle = other.m_backendHandle;
296 other.m_backendHandle = nullptr;
297 }
298
299 return *this;
300}
301
302inline void GammaCorrector::SetGammaCorrectionValue(float gammaValue)
303{
306 m_backendHandle, reinterpret_cast<float*>(&gammaValue));
307 });
308}
309
311{
312 float gammaValue;
313
316 m_backendHandle, reinterpret_cast<float*>(&gammaValue));
317 });
318
319 return gammaValue;
320}
321
323{
324 float gammaMin;
325
328 m_backendHandle, reinterpret_cast<float*>(&gammaMin));
329 });
330
331 return gammaMin;
332}
333
335{
336 float gammaMax;
337
340 m_backendHandle, reinterpret_cast<float*>(&gammaMax));
341 });
342
343 return gammaMax;
344}
345
346inline void GammaCorrector::SetDigitalBlack(float digitalBlackValue)
347{
350 m_backendHandle, reinterpret_cast<float*>(&digitalBlackValue));
351 });
352}
353
355{
356 float digitalBlackValue;
357
360 m_backendHandle, reinterpret_cast<float*>(&digitalBlackValue));
361 });
362
363 return digitalBlackValue;
364}
365
367{
368 float digitalBlackMin;
369
372 m_backendHandle, reinterpret_cast<float*>(&digitalBlackMin));
373 });
374
375 return digitalBlackMin;
376}
377
379{
380 float digitalBlackMax;
381
384 m_backendHandle, reinterpret_cast<float*>(&digitalBlackMax));
385 });
386
387 return digitalBlackMax;
388}
389
391{
392 PEAK_IPL_BOOL8 isPixelFormatSupported = 0;
393
396 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormatName),
397 reinterpret_cast<PEAK_IPL_BOOL8*>(&isPixelFormatSupported));
398 });
399
400 return isPixelFormatSupported > 0;
401}
402
403inline void GammaCorrector::ProcessInPlace(Image& image) const
404{
407 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
408 });
409}
410
411inline Image GammaCorrector::Process(const Image& inputImage) const
412{
413 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
416 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
417 });
418
419 return ImageBackendAccessor::CreateImage(outputImageHandle);
420}
421
422} /* namespace ipl */
423} /* namespace peak */
GammaCorrector & operator=(const GammaCorrector &other)
Copy assigment for GammaCorrector instance.
Definition peak_ipl_gamma_corrector.hpp:266
~GammaCorrector()
Destructor for the GammaCorrector instance.
Definition peak_ipl_gamma_corrector.hpp:241
float GammaCorrectionMin() const
Returns the minimum value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:322
float DigitalBlackMax() const
Returns the maximum value of the digital black correction.
Definition peak_ipl_gamma_corrector.hpp:378
Image Process(const Image &inputImage) const
Corrects the gammas of the given image.
Definition peak_ipl_gamma_corrector.hpp:411
float GammaCorrectionValue() const
Returns the value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:310
float DigitalBlack() const
Returns the value of the digital black correction.
Definition peak_ipl_gamma_corrector.hpp:354
void SetGammaCorrectionValue(float gammaValue)
Sets the gamma value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:302
float GammaCorrectionMax() const
Returns the maximum value of the gamma correction.
Definition peak_ipl_gamma_corrector.hpp:334
void SetDigitalBlack(float digitalBlackValue)
Configures the digital black correction value to adjust RGB master black.
Definition peak_ipl_gamma_corrector.hpp:346
bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const
Returns whether the gamma corrector supports the given pixel format.
Definition peak_ipl_gamma_corrector.hpp:390
GammaCorrector()
Constructor for a new GammaCorrector instance.
Definition peak_ipl_gamma_corrector.hpp:236
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:403
float DigitalBlackMin() const
Returns the minimum value of the digital black correction.
Definition peak_ipl_gamma_corrector.hpp:366
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:42
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
struct PEAK_IPL_GAMMA_CORRECTOR * PEAK_IPL_GAMMA_CORRECTOR_HANDLE
Definition peak_ipl_backend.h:398
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:402
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:23
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:170
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:11