IDS peak IPL  v1.7.0
peak_ipl_gain.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 
18 
22 namespace peak
23 {
24 namespace ipl
25 {
26 
30 class Gain final
31 {
32 public:
33  Gain();
34  ~Gain();
35  Gain(const Gain& other) = delete;
36  Gain& operator=(const Gain& other) = delete;
37  Gain(Gain&& other) noexcept;
38  Gain& operator=(Gain&& other) noexcept;
39 
49  void SetMasterGainValue(float masterGainValue);
50 
58  float MasterGainValue() const;
59 
67  float MasterGainMin() const;
68 
76  float MasterGainMax() const;
77 
87  void SetRedGainValue(float redGainValue);
88 
96  float RedGainValue() const;
97 
105  float RedGainMin() const;
106 
114  float RedGainMax() const;
115 
125  void SetGreenGainValue(float greenGainValue);
126 
134  float GreenGainValue() const;
135 
143  float GreenGainMin() const;
144 
152  float GreenGainMax() const;
153 
163  void SetBlueGainValue(float blueGainValue);
164 
172  float BlueGainValue() const;
173 
181  float BlueGainMin() const;
182 
190  float BlueGainMax() const;
191 
201  bool IsPixelFormatSupported(PixelFormatName pixelFormatName) const;
202 
212  void ProcessInPlace(Image& image) const;
213 
224  Image Process(const Image& inputImage) const;
225 
226 private:
227  PEAK_IPL_GAIN_HANDLE m_backendHandle{};
228 };
229 inline Gain::Gain()
230 {
232 }
233 inline Gain::~Gain()
234 {
235  if (m_backendHandle)
236  {
237  (void)PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Gain_Destruct(m_backendHandle);
238  }
239 }
240 inline Gain::Gain(Gain&& other) noexcept
241 {
242  *this = std::move(other);
243 }
244 inline Gain& Gain::operator=(Gain&& other) noexcept
245 {
246  if (this != &other)
247  {
248  (void)PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Gain_Destruct(m_backendHandle);
249  m_backendHandle = other.m_backendHandle;
250  other.m_backendHandle = nullptr;
251  }
252 
253  return *this;
254 }
255 inline void Gain::SetMasterGainValue(float masterGainValue)
256 {
259  m_backendHandle, reinterpret_cast<float*>(&masterGainValue));
260  });
261 }
262 inline float Gain::MasterGainValue() const
263 {
264  float masterGainValue;
265 
268  m_backendHandle, reinterpret_cast<float*>(&masterGainValue));
269  });
270 
271  return masterGainValue;
272 }
273 inline float Gain::MasterGainMin() const
274 {
275  float masterGainMin;
276 
279  m_backendHandle, reinterpret_cast<float*>(&masterGainMin));
280  });
281 
282  return masterGainMin;
283 }
284 inline float Gain::MasterGainMax() const
285 {
286  float masterGainMax;
287 
290  m_backendHandle, reinterpret_cast<float*>(&masterGainMax));
291  });
292 
293  return masterGainMax;
294 }
295 inline void Gain::SetRedGainValue(float redGainValue)
296 {
299  m_backendHandle, reinterpret_cast<float*>(&redGainValue));
300  });
301 }
302 inline float Gain::RedGainValue() const
303 {
304  float redGainValue;
305 
308  m_backendHandle, reinterpret_cast<float*>(&redGainValue));
309  });
310 
311  return redGainValue;
312 }
313 inline float Gain::RedGainMin() const
314 {
315  float redGainMin;
316 
318  return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Gain_GetRedGainMin(m_backendHandle, reinterpret_cast<float*>(&redGainMin));
319  });
320 
321  return redGainMin;
322 }
323 inline float Gain::RedGainMax() const
324 {
325  float redGainMax;
326 
328  return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Gain_GetRedGainMax(m_backendHandle, reinterpret_cast<float*>(&redGainMax));
329  });
330 
331  return redGainMax;
332 }
333 inline void Gain::SetGreenGainValue(float greenGainValue)
334 {
337  m_backendHandle, reinterpret_cast<float*>(&greenGainValue));
338  });
339 }
340 inline float Gain::GreenGainValue() const
341 {
342  float greenGainValue;
343 
346  m_backendHandle, reinterpret_cast<float*>(&greenGainValue));
347  });
348 
349  return greenGainValue;
350 }
351 inline float Gain::GreenGainMin() const
352 {
353  float greenGainMin;
354 
357  m_backendHandle, reinterpret_cast<float*>(&greenGainMin));
358  });
359 
360  return greenGainMin;
361 }
362 inline float Gain::GreenGainMax() const
363 {
364  float greenGainMax;
365 
368  m_backendHandle, reinterpret_cast<float*>(&greenGainMax));
369  });
370 
371  return greenGainMax;
372 }
373 inline void Gain::SetBlueGainValue(float blueGainValue)
374 {
377  m_backendHandle, reinterpret_cast<float*>(&blueGainValue));
378  });
379 }
380 inline float Gain::BlueGainValue() const
381 {
382  float blueGainValue;
383 
386  m_backendHandle, reinterpret_cast<float*>(&blueGainValue));
387  });
388 
389  return blueGainValue;
390 }
391 inline float Gain::BlueGainMin() const
392 {
393  float blueGainMin;
394 
397  m_backendHandle, reinterpret_cast<float*>(&blueGainMin));
398  });
399 
400  return blueGainMin;
401 }
402 inline float Gain::BlueGainMax() const
403 {
404  float blueGainMax;
405 
408  m_backendHandle, reinterpret_cast<float*>(&blueGainMax));
409  });
410 
411  return blueGainMax;
412 }
413 inline bool Gain::IsPixelFormatSupported(PixelFormatName pixelFormatName) const
414 {
415  PEAK_IPL_BOOL8 isPixelFormatSupported = 0;
416 
419  static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormatName),
420  reinterpret_cast<PEAK_IPL_BOOL8*>(&isPixelFormatSupported));
421  });
422 
423  return isPixelFormatSupported > 0;
424 }
425 inline void Gain::ProcessInPlace(Image& image) const
426 {
429  m_backendHandle, ImageBackendAccessor::BackendHandle(image));
430  });
431 }
432 inline Image Gain::Process(const Image& inputImage) const
433 {
434  PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
437  m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
438  });
439 
440  return ImageBackendAccessor::CreateImage(outputImageHandle);
441 }
442 
443 } /* namespace ipl */
444 } /* 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:413
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:373
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:233
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:262
float BlueGainMax() const
Returns the maximum value of the blue gain.
Definition: peak_ipl_gain.hpp:402
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:362
The "peak::ipl" namespace contains the whole image processing library.
Definition: peak_ipl_binning.hpp:22
float BlueGainMin() const
Returns the minimum value of the blue gain.
Definition: peak_ipl_gain.hpp:391
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:425
void SetMasterGainValue(float masterGainValue)
Sets the values of the master Gain.
Definition: peak_ipl_gain.hpp:255
float RedGainMin() const
Returns the minimum value of the red gain.
Definition: peak_ipl_gain.hpp:313
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:39
void SetGreenGainValue(float greenGainValue)
Sets the values of the green Gain.
Definition: peak_ipl_gain.hpp:333
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:340
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:323
struct PEAK_IPL_IMAGE * PEAK_IPL_IMAGE_HANDLE
Definition: peak_ipl_backend.h:326
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:351
float RedGainValue() const
Returns the value of the red gain.
Definition: peak_ipl_gain.hpp:302
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:318
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:284
Gain()
Definition: peak_ipl_gain.hpp:229
Image Process(const Image &inputImage) const
Applies the gain on the given image.
Definition: peak_ipl_gain.hpp:432
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:30
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:273
float BlueGainValue() const
Returns the value of the blue gain.
Definition: peak_ipl_gain.hpp:380
void SetRedGainValue(float redGainValue)
Sets the values of the red Gain.
Definition: peak_ipl_gain.hpp:295