SpatiumLib
|
Color image to grayscale. More...
#include <Grayscale.h>
Public Member Functions | |
Grayscale (double redCoeff=0.2125, double greenCoeff=0.7154, double blueCoff=0.0721) | |
Constructor. More... | |
bool | apply (const Image< T, 3 > &input, Image< T, 1 > &output) |
Apply filter. More... | |
void | setCoefficients (double redCoeff, double greenCoeff, double blueCoeff) |
Set RGB coefficients. More... | |
std::array< double, 3 > | coefficients () const |
Get RGB coefficients. More... | |
![]() | |
virtual | ~IImageFilter ()=default |
Color image to grayscale.
Convert color image as RGB format to grayscale.
|
inline |
Constructor.
Coefficients are used to convert 3 RGB values to 1 grayscale value. Each coefficient is a weight for a partical channel: red, green and blue. The sum of the coefficients should be 1.
[in] | redCoeff | Red coefficient (default = 0.2125) |
[in] | greenCoeff | Green coefficient (default = 0.7154) |
[in] | blueCoff | Blue coefficient (default = 0.0721) |
|
inline |
Apply filter.
[in] | input | RGB image with 3 channels |
[out] | output | Grayscale image with 1 channel |
|
inline |
Get RGB coefficients.
These coefficients are used to convert 3 RGB values to 1 grayscale value. Each coefficient is a weight for a partical channel: red, green and blue. The sum of the coefficients should be 1.
|
inline |
Set RGB coefficients.
These coefficients are used to convert 3 RGB values to 1 grayscale value. Each coefficient is a weight for a partical channel: red, green and blue. The sum of the coefficients should be 1.
[in] | redCoeff | Red coefficient (default = 0.2125) |
[in] | greenCoeff | Green coefficient (default = 0.7154) |
[in] | blueCoff | Blue coefficient (default = 0.0721) |