IDS peak IPL  v1.5.0
peak_ipl_gain.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 
16 namespace peak
17 {
18 namespace ipl
19 {
20 
21 class Image;
22 
26 class Gain final
27 {
28 public:
29  Gain();
30  ~Gain();
31  Gain(const Gain& other) = delete;
32  Gain& operator=(const Gain& other) = delete;
33  Gain(Gain&& other);
34  Gain& operator=(Gain&& other);
35 
45  void SetMasterGainValue(float masterGainValue);
46 
54  float MasterGainValue() const;
55 
63  float MasterGainMin() const;
64 
72  float MasterGainMax() const;
73 
83  void SetRedGainValue(float redGainValue);
84 
92  float RedGainValue() const;
93 
101  float RedGainMin() const;
102 
110  float RedGainMax() const;
111 
121  void SetGreenGainValue(float greenGainValue);
122 
130  float GreenGainValue() const;
131 
139  float GreenGainMin() const;
140 
148  float GreenGainMax() const;
149 
159  void SetBlueGainValue(float blueGainValue);
160 
168  float BlueGainValue() const;
169 
177  float BlueGainMin() const;
178 
186  float BlueGainMax() const;
187 
197  bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const;
198 
208  void ProcessInPlace(Image& image) const;
209 
220  Image Process(const Image& inputImage) const;
221 
222 private:
223  PEAK_IPL_GAIN_HANDLE m_backendHandle{};
224 };
225 inline Gain::Gain()
226 {
228 }
229 inline Gain::~Gain()
230 {
231  (void)PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Gain_Destruct(m_backendHandle);
232 }
233 inline Gain::Gain(Gain&& other)
234 {
235  *this = std::move(other);
236 }
237 inline Gain& Gain::operator=(Gain&& other)
238 {
239  if (this != &other)
240  {
241  (void)PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Gain_Destruct(m_backendHandle);
242  m_backendHandle = other.m_backendHandle;
243  other.m_backendHandle = nullptr;
244  }
245 
246  return *this;
247 }
248 inline void Gain::SetMasterGainValue(float masterGainValue)
249 {
252  m_backendHandle, reinterpret_cast<float*>(&masterGainValue));
253  });
254 }
255 inline float Gain::MasterGainValue() const
256 {
257  float masterGainValue;
258 
261  m_backendHandle, reinterpret_cast<float*>(&masterGainValue));
262  });
263 
264  return masterGainValue;
265 }
266 inline float Gain::MasterGainMin() const
267 {
268  float masterGainMin;
269 
272  m_backendHandle, reinterpret_cast<float*>(&masterGainMin));
273  });
274 
275  return masterGainMin;
276 }
277 inline float Gain::MasterGainMax() const
278 {
279  float masterGainMax;
280 
283  m_backendHandle, reinterpret_cast<float*>(&masterGainMax));
284  });
285 
286  return masterGainMax;
287 }
288 inline void Gain::SetRedGainValue(float redGainValue)
289 {
292  m_backendHandle, reinterpret_cast<float*>(&redGainValue));
293  });
294 }
295 inline float Gain::RedGainValue() const
296 {
297  float redGainValue;
298 
301  m_backendHandle, reinterpret_cast<float*>(&redGainValue));
302  });
303 
304  return redGainValue;
305 }
306 inline float Gain::RedGainMin() const
307 {
308  float redGainMin;
309 
311  return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Gain_GetRedGainMin(m_backendHandle, reinterpret_cast<float*>(&redGainMin));
312  });
313 
314  return redGainMin;
315 }
316 inline float Gain::RedGainMax() const
317 {
318  float redGainMax;
319 
321  return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Gain_GetRedGainMax(m_backendHandle, reinterpret_cast<float*>(&redGainMax));
322  });
323 
324  return redGainMax;
325 }
326 inline void Gain::SetGreenGainValue(float greenGainValue)
327 {
330  m_backendHandle, reinterpret_cast<float*>(&greenGainValue));
331  });
332 }
333 inline float Gain::GreenGainValue() const
334 {
335  float greenGainValue;
336 
339  m_backendHandle, reinterpret_cast<float*>(&greenGainValue));
340  });
341 
342  return greenGainValue;
343 }
344 inline float Gain::GreenGainMin() const
345 {
346  float greenGainMin;
347 
350  m_backendHandle, reinterpret_cast<float*>(&greenGainMin));
351  });
352 
353  return greenGainMin;
354 }
355 inline float Gain::GreenGainMax() const
356 {
357  float greenGainMax;
358 
361  m_backendHandle, reinterpret_cast<float*>(&greenGainMax));
362  });
363 
364  return greenGainMax;
365 }
366 inline void Gain::SetBlueGainValue(float blueGainValue)
367 {
370  m_backendHandle, reinterpret_cast<float*>(&blueGainValue));
371  });
372 }
373 inline float Gain::BlueGainValue() const
374 {
375  float blueGainValue;
376 
379  m_backendHandle, reinterpret_cast<float*>(&blueGainValue));
380  });
381 
382  return blueGainValue;
383 }
384 inline float Gain::BlueGainMin() const
385 {
386  float blueGainMin;
387 
390  m_backendHandle, reinterpret_cast<float*>(&blueGainMin));
391  });
392 
393  return blueGainMin;
394 }
395 inline float Gain::BlueGainMax() const
396 {
397  float blueGainMax;
398 
401  m_backendHandle, reinterpret_cast<float*>(&blueGainMax));
402  });
403 
404  return blueGainMax;
405 }
406 inline bool Gain::IsPixelFormatSupported(PixelFormatName pixelFormatName) const
407 {
408  PEAK_IPL_BOOL8 isPixelFormatSupported = 0;
409 
412  static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormatName),
413  reinterpret_cast<PEAK_IPL_BOOL8*>(&isPixelFormatSupported));
414  });
415 
416  return isPixelFormatSupported > 0;
417 }
418 inline void Gain::ProcessInPlace(Image& image) const
419 {
422  m_backendHandle, ImageBackendAccessor::BackendHandle(image));
423  });
424 }
425 inline Image Gain::Process(const Image& inputImage) const
426 {
427  PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
430  m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
431  });
432 
433  return ImageBackendAccessor::CreateImage(outputImageHandle);
434 }
435 
436 } /* namespace ipl */
437 } /* namespace peak */
PEAK_IPL_C_API PEAK_IPL_Gain_GetMasterGainMin(PEAK_IPL_GAIN_HANDLE gainHandle, float *masterGainMin)
Returns the minimum master gain value which can be set.
bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const
Returns whether the gain supports the given pixel format.
Definition: peak_ipl_gain.hpp:406
PEAK_IPL_C_API PEAK_IPL_Gain_GetRedGainValue(PEAK_IPL_GAIN_HANDLE gainHandle, float *redGainValue)
Returns the red gain value.
void SetBlueGainValue(float blueGainValue)
Sets the values of the blue Gain.
Definition: peak_ipl_gain.hpp:366
PEAK_IPL_C_API PEAK_IPL_Gain_SetGreenGainValue(PEAK_IPL_GAIN_HANDLE gainHandle, float *greenGainValue)
Sets the value of the green gain.
PEAK_IPL_C_API PEAK_IPL_Gain_GetRedGainMin(PEAK_IPL_GAIN_HANDLE gainHandle, float *redGainMin)
Returns the minimum red gain value which can be set.
PEAK_IPL_C_API PEAK_IPL_Gain_GetMasterGainMax(PEAK_IPL_GAIN_HANDLE gainHandle, float *masterGainMax)
Returns the maximum master gain value which can be set.
#define PEAK_IPL_C_ABI_PREFIX
Definition: peak_ipl_dll_defines.h:16
~Gain()
Definition: peak_ipl_gain.hpp:229
PEAK_IPL_C_API PEAK_IPL_Gain_SetRedGainValue(PEAK_IPL_GAIN_HANDLE gainHandle, float *redGainValue)
Sets the value of the red gain.
PixelFormatName
Enum holding the possible pixel format names.
Definition: peak_ipl_simple_types.hpp:38
float MasterGainValue() const
Returns the value of the master gain.
Definition: peak_ipl_gain.hpp:255
float BlueGainMax() const
Returns the maximum value of the blue gain.
Definition: peak_ipl_gain.hpp:395
PEAK_IPL_C_API PEAK_IPL_Gain_GetGreenGainMax(PEAK_IPL_GAIN_HANDLE gainHandle, float *greenGainMax)
Returns the maximum green gain value which can be set.
float GreenGainMax() const
Returns the maximum value of the green gain.
Definition: peak_ipl_gain.hpp:355
The "peak::ipl" namespace contains the whole image processing library.
Definition: peak_ipl_binning.hpp:16
float BlueGainMin() const
Returns the minimum value of the blue gain.
Definition: peak_ipl_gain.hpp:384
void ProcessInPlace(Image &image) const
Applies the gain on the given image in place i.e. it will change the input image. ...
Definition: peak_ipl_gain.hpp:418
void SetMasterGainValue(float masterGainValue)
Sets the values of the master Gain.
Definition: peak_ipl_gain.hpp:248
float RedGainMin() const
Returns the minimum value of the red gain.
Definition: peak_ipl_gain.hpp:306
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition: peak_ipl_exception.hpp:182
Stores the pixel format, width and height of an image and the pointer to the image buffer...
Definition: peak_ipl_image.hpp:37
void SetGreenGainValue(float greenGainValue)
Sets the values of the green Gain.
Definition: peak_ipl_gain.hpp:326
Gain & operator=(const Gain &other)=delete
PEAK_IPL_C_API PEAK_IPL_Gain_GetBlueGainValue(PEAK_IPL_GAIN_HANDLE gainHandle, float *blueGainValue)
Returns the blue gain value.
float GreenGainValue() const
Returns the value of the green gain.
Definition: peak_ipl_gain.hpp:333
PEAK_IPL_C_API PEAK_IPL_Gain_GetBlueGainMax(PEAK_IPL_GAIN_HANDLE gainHandle, float *blueGainMax)
Returns the maximum blue gain value which can be set.
float RedGainMax() const
Returns the maximum value of the red gain.
Definition: peak_ipl_gain.hpp:316
struct PEAK_IPL_IMAGE * PEAK_IPL_IMAGE_HANDLE
Definition: peak_ipl_backend.h:267
PEAK_IPL_C_API PEAK_IPL_Gain_Destruct(PEAK_IPL_GAIN_HANDLE gainHandle)
Destroys the gain associated with the given handle.
float GreenGainMin() const
Returns the minimum value of the green gain.
Definition: peak_ipl_gain.hpp:344
float RedGainValue() const
Returns the value of the red gain.
Definition: peak_ipl_gain.hpp:295
PEAK_IPL_C_API PEAK_IPL_Gain_SetMasterGainValue(PEAK_IPL_GAIN_HANDLE gainHandle, float *masterGainValue)
Sets the value of the master gain.
PEAK_IPL_C_API PEAK_IPL_Gain_Process(PEAK_IPL_GAIN_HANDLE gainHandle, PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Apply the gain on the given image.
PEAK_IPL_C_API PEAK_IPL_Gain_GetIsPixelFormatSupported(PEAK_IPL_GAIN_HANDLE gainHandle, 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_Gain_Construct(PEAK_IPL_GAIN_HANDLE *gainHandle)
Creates a gain.
struct PEAK_IPL_GAIN * PEAK_IPL_GAIN_HANDLE
Definition: peak_ipl_backend.h:259
PEAK_IPL_C_API PEAK_IPL_Gain_GetGreenGainValue(PEAK_IPL_GAIN_HANDLE gainHandle, float *greenGainValue)
Returns the green gain value.
PEAK_IPL_C_API PEAK_IPL_Gain_GetGreenGainMin(PEAK_IPL_GAIN_HANDLE gainHandle, float *greenGainMin)
Returns the minimum green gain value which can be set.
int8_t PEAK_IPL_BOOL8
Definition: peak_ipl_backend.h:25
float MasterGainMax() const
Returns the maximum value of the master gain.
Definition: peak_ipl_gain.hpp:277
Gain()
Definition: peak_ipl_gain.hpp:225
Image Process(const Image &inputImage) const
Applies the gain on the given image.
Definition: peak_ipl_gain.hpp:425
PEAK_IPL_C_API PEAK_IPL_Gain_SetBlueGainValue(PEAK_IPL_GAIN_HANDLE gainHandle, float *blueGainValue)
Sets the value of the blue gain.
PEAK_IPL_C_API PEAK_IPL_Gain_GetMasterGainValue(PEAK_IPL_GAIN_HANDLE gainHandle, float *masterGainValue)
Returns the master gain value.
PEAK_IPL_C_API PEAK_IPL_Gain_GetRedGainMax(PEAK_IPL_GAIN_HANDLE gainHandle, float *redGainMax)
Returns the maximum red gain value which can be set.
Applies gain to the data.
Definition: peak_ipl_gain.hpp:26
PEAK_IPL_C_API PEAK_IPL_Gain_ProcessInPlace(PEAK_IPL_GAIN_HANDLE gainHandle, PEAK_IPL_IMAGE_HANDLE imageHandle)
Apply the gain on the given image.
PEAK_IPL_C_API PEAK_IPL_Gain_GetBlueGainMin(PEAK_IPL_GAIN_HANDLE gainHandle, float *blueGainMin)
Returns the minimum blue gain value which can be set.
float MasterGainMin() const
Returns the minimum value of the master gain.
Definition: peak_ipl_gain.hpp:266
float BlueGainValue() const
Returns the value of the blue gain.
Definition: peak_ipl_gain.hpp:373
void SetRedGainValue(float redGainValue)
Sets the values of the red Gain.
Definition: peak_ipl_gain.hpp:288