46 double Red() const noexcept
48 return static_cast<double>(red_) / ConversionFactor;
58 if ((red < 0.0) || (red > MaxFactor))
61 red_ =
static_cast<int>(red * ConversionFactor);
71 return static_cast<double>(green_) / ConversionFactor;
81 if ((green < 0.0) || (green > MaxFactor))
84 green_ =
static_cast<int>(green *ConversionFactor);
92 double Blue() const noexcept
94 return static_cast<double>(blue_) / ConversionFactor;
105 if ((blue < 0.0) || (blue > MaxFactor))
108 blue_ =
static_cast<int>(blue * ConversionFactor);
127 static constexpr double MaxFactor = 16.0;
128 static constexpr double ConversionFactor = 256.0;
146 double red, green, blue;
147 if (!CVB_CALL_CAPI(CalculateWhiteBalance(image.Handle(),
148 *
reinterpret_cast<CExports::TArea*
>(&aoi),
152 Utilities::SystemInfo::ThrowLastError();
168 if (!CVB_CALL_CAPI(ApplyWhiteBalance(image.Handle(), factors.
Red(), factors.
Green(), factors.
Blue())))
169 Utilities::SystemInfo::ThrowLastError();
Structure that represents an area of interest in the image.
Definition: area_2d.hpp:21
The Common Vision Blox image.
Definition: decl_image.hpp:45
Factors for white balance correction.
Definition: white_balance.hpp:24
void SetGreen(double green)
Sets the white balance factor for the green channel.
Definition: white_balance.hpp:79
void ApplyWhiteBalanceFactors(const Image &image, WhiteBalanceFactors factors)
Applies the white balance factors to the given image.
Definition: white_balance.hpp:166
double Green() const noexcept
Gets the white balance factor for the geen channel.
Definition: white_balance.hpp:69
double Blue() const noexcept
Gets the white balance factor for the blue channel.
Definition: white_balance.hpp:92
WhiteBalanceFactors CalculateWhiteBalanceFactors(const Image &image, Area2D aoi)
Calculate the red, green and blue gain factor for white balancing.
Definition: white_balance.hpp:144
void SetRed(double red)
Sets the white balance factor for the red channel.
Definition: white_balance.hpp:56
WhiteBalanceFactors(double red, double green, double blue)
Initialize a white balance factors structure.
Definition: white_balance.hpp:34
void SetBlue(double blue)
Sets the white balance factor for the blue channel.
Definition: white_balance.hpp:103
static WhiteBalanceFactors Identity() noexcept
Identity transformation leaving all values as they are.
Definition: white_balance.hpp:116
double Red() const noexcept
Gets the white balance factor for the red channel.
Definition: white_balance.hpp:46
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24