Basic Image AlgorithmS Library
2.8.0
|
Represents a colour gradient. More...
#include <Utils/ColourGradient.hh>
Public Types | |
enum | ColourGradientType { Gray, Cool, Hot, Bone, Jet } |
Different types of predefined color gradients that can be generated. More... | |
Public Member Functions | |
void | AddColour (float pos, const std::vector< StorageType > &colour) |
Adds a colour to this ColourGradient. More... | |
void | AddRGBColour (float pos, const StorageType r, const StorageType g, const StorageType b) |
Convenience wrapper. More... | |
ColourGradient () | |
Default Constructor. More... | |
ColourGradient (std::vector< StorageType > colourLeft, std::vector< StorageType > colourRight) | |
Constructor. More... | |
ColourGradient (ColourGradientType mapType, const StorageType max=255) | |
Constructor that allows to generate from a predefined color map. More... | |
void | GetColour (float pos, std::vector< StorageType > &colour) |
Returns the interpolated colour at a given position. More... | |
Represents a colour gradient.
The ColourGradient is a function [0,1] -> YOUR_COLOUR_SPACE.
The gradient will consist of at least two colours: one colour on the "left" side (at position 0) and one on the "right" side (at position 1). Intermediate colours can be added with AddColour().
To get a linearly interpolated colour at a certain position call GetColour().
Definition at line 54 of file ColourGradient.hh.
enum BIAS::ColourGradient::ColourGradientType |
Different types of predefined color gradients that can be generated.
Inspired by Matlab.
Enumerator | |
---|---|
Gray | |
Cool | |
Hot | |
Bone | |
Jet |
Definition at line 64 of file ColourGradient.hh.
BIAS::ColourGradient< StorageType >::ColourGradient | ( | ) |
Default Constructor.
Initialises with gray-scale gradient from black to white, assuming 3 channels and unsigned char.
Definition at line 33 of file ColourGradient.cpp.
BIAS::ColourGradient< StorageType >::ColourGradient | ( | std::vector< StorageType > | colourLeft, |
std::vector< StorageType > | colourRight | ||
) |
Constructor.
colourLeft | the colour at position 0 |
colourRight | the colour at position 1 |
Definition at line 105 of file ColourGradient.cpp.
BIAS::ColourGradient< StorageType >::ColourGradient | ( | ColourGradientType | mapType, |
const StorageType | max = 255 |
||
) |
Constructor that allows to generate from a predefined color map.
The color maximas are set to max e.g. blue is (0 0 max)
void ColourGradient::AddColour | ( | float | pos, |
const std::vector< StorageType > & | colour | ||
) |
Adds a colour to this ColourGradient.
If a colour already exists at the given pos, it is replaced by the new value.
pos | the position where the new colour is to be set, must be in [0,1] |
colour | the new colour to set, must have the same size as the colours given to the constructor |
Definition at line 127 of file ColourGradient.cpp.
void BIAS::ColourGradient< StorageType >::AddRGBColour | ( | float | pos, |
const StorageType | r, | ||
const StorageType | g, | ||
const StorageType | b | ||
) |
Convenience wrapper.
Definition at line 213 of file ColourGradient.cpp.
void BIAS::ColourGradient< StorageType >::GetColour | ( | float | pos, |
std::vector< StorageType > & | colour | ||
) |
Returns the interpolated colour at a given position.
The colour is interpolated linearly between the nearest colours that were added before.
pos | the position for which the interpolated colour should be returned, must be in [0,1] |
colour | the returned interpolated colour |
Definition at line 174 of file ColourGradient.cpp.