Generation and processing of per-vertex and per-face colors according to various strategy. More...
#include <vcg/complex/algorithms/update/color.h>
Classes | |
class | ColorAvgInfo |
Public Types | |
typedef MeshType::CoordType | CoordType |
enum | DesaturationMethods { M_LIGHTNESS = 0, M_LUMINOSITY = 1, M_AVERAGE = 2 } |
typedef MeshType::EdgeIterator | EdgeIterator |
typedef MeshType::FaceIterator | FaceIterator |
typedef MeshType::FacePointer | FacePointer |
typedef MeshType::FaceType | FaceType |
enum | rgbChMask { ALL_CHANNELS = 7, RED_CHANNEL = 4, GREEN_CHANNEL = 2, BLUE_CHANNEL = 1, NO_CHANNELS = 0 } |
typedef MeshType::ScalarType | ScalarType |
typedef MeshType::VertexIterator | VertexIterator |
typedef MeshType::VertexPointer | VertexPointer |
typedef MeshType::VertexType | VertexType |
Static Public Member Functions | |
static Color4b | ColorApplyDiff (Color4b old_color, Color4b new_color, float intensity) |
static Color4b | ColorBrightnessContrast (Color4b c, float brightness, float contrast) |
static Color4b | ColorDesaturate (Color4b c, int method) |
static Color4b | ColorEqualize (Color4b c, int cdf_l[256], int cdf_r[256], int cdf_g[256], int cdf_b[256], unsigned int rgbMask) |
static Color4b | ColorLevels (Color4b c, float gamma, float in_min, float in_max, float out_min, float out_max, unsigned char rgbMask) |
static Color4b | ColorMul (Color4b c, float factor) |
static Color4b | ColorPow (Color4b c, float exponent) |
static Color4b | ColorWhiteBalance (Color4b c, Color4b unbalancedWhite) |
static float | ComputeAvgLightness (Color4b c) |
static float | ComputeLightness (Color4b c) |
static float | ComputeLuminosity (Color4b c) |
static void | PerEdgeQualityRamp (MeshType &m, float minq=0, float maxq=0, bool selected=false) |
This function colores all the edges of a mesh with a hue color shade dependent on the quality. | |
static int | PerFaceConstant (MeshType &m, Color4b vs=Color4b::White, bool selected=false) |
This function colores all (or the selected) faces of a mesh. | |
static void | PerFaceFromVertex (MeshType &m) |
Transfer vertex color onto face color Plain average of the color of the vertexes on a given face. | |
static void | PerFaceQualityGray (MeshType &m, float minq=0, float maxq=0) |
This function colores all the faces of a mesh with a gray shade dependent on the quality. | |
static void | PerFaceQualityRamp (MeshType &m, float minq=0, float maxq=0, bool selected=false) |
This function colores all the faces of a mesh with a hue color shade dependent on the quality. | |
static void | PerFaceRandom (MeshType &m) |
This function colores the face of a mesh randomly. | |
static void | PerFaceRandomConnectedComponent (MeshType &m) |
This function colores the faces of connected components of a mesh randomly. | |
static void | PerVertexAddNoise (MeshType &m, int noiseBits, bool onSelected=false) |
Simple Noise adding function. It simply add signed noise to the color of the mesh. The noise has uniform distribution and the amplitude is +/-2^(noisebits-1). | |
static void | PerVertexBorderFlag (MeshType &m, Color4b BorderColor=Color4b::Blue, Color4b InternalColor=Color4b::White, Color4b MixColor=Color4b::Cyan) |
Color the vertexes of the mesh that are on the border. | |
static int | PerVertexBrightness (MeshType &m, float amount, const bool ProcessSelected=false) |
Apply the brightness filter, with the given amount, to the mesh. | |
static int | PerVertexBrightnessContrast (MeshType &m, float brightness, float contrast, const bool ProcessSelected=false) |
Apply Brightness and Contrast filter to the mesh, with the given contrast factor and brightness amount. | |
static int | PerVertexColourisation (MeshType &m, Color4b c, float intensity, const bool ProcessSelected=false) |
Colorize the mesh toward a given color. | |
static int | PerVertexConstant (MeshType &m, Color4b vs=Color4b::White, bool selected=false) |
This function colores all (or the selected) the vertices of a mesh. | |
static int | PerVertexContrast (MeshType &m, float factor, const bool ProcessSelected=false) |
Apply Contrast filter to the mesh with the given contrast factor. | |
static int | PerVertexDesaturation (MeshType &m, int method, const bool ProcessSelected=false) |
Desaturates the mesh according the a chosen desaturation method. | |
static int | PerVertexEqualize (MeshType &m, unsigned int rgbMask, const bool ProcessSelected=false) |
Histogram Color Equalization. | |
static void | PerVertexFromFace (MeshType &m) |
Transfer face color onto vertex color. | |
static int | PerVertexGamma (MeshType &m, float gamma, const bool ProcessSelected=false) |
Apply the gamma correction filter, with the given gamma exponet, to the mesh. | |
static int | PerVertexInvert (MeshType &m, const bool ProcessSelected=false) |
Invert the colors of the mesh. | |
static int | PerVertexLevels (MeshType &m, float gamma, float in_min, float in_max, float out_min, float out_max, unsigned char rgbMask, const bool ProcessSelected=false) |
Adjusts color levels of the mesh. | |
static void | PerVertexPerlinNoise (MeshType &m, CoordType period, CoordType offset=CoordType(0, 0, 0), bool onSelected=false) |
Perlin Noise. | |
static void | PerVertexQualityGray (MeshType &m, float minq, float maxq) |
This function colores all the vertices of a mesh with a gray shade dependent on the quality. | |
static void | PerVertexQualityRamp (MeshType &m, float minq=0, float maxq=0) |
This function colores all the faces of a mesh with a hue color shade dependent on the quality. | |
static void | PerVertexQualityRampParula (MeshType &m, float minq=0, float maxq=0) |
This function colores all the faces of a mesh with a hue color shade dependent on the quality. | |
static int | PerVertexThresholding (MeshType &m, float threshold, Color4b c1=Color4< unsigned char >::Black, Color4b c2=Color4< unsigned char >::White, const bool ProcessSelected=false) |
Reduces vertex color the mesh to two colors according to a threshold. | |
static int | PerVertexWhiteBalance (MeshType &m, Color4b userColor, const bool ProcessSelected=false) |
Simple white balancing filter. | |
static int | ValueApplyDiff (int old_value, int new_value, float intensity) |
static int | ValueBrightnessContrast (unsigned char ivalue, float brightness, float contrast) |
static int | ValueEqualize (int cdfValue, int cdfMin, int cdfMax) |
static int | ValueLevels (int value, float gamma, float in_min, float in_max, float out_min, float out_max) |
static int | ValueMul (int value, float factor) |
static float | ValuePow (float value, float exponent) |
Generation and processing of per-vertex and per-face colors according to various strategy.
This class is used to compute per face or per vertex color with respect to a number of algorithms. There is a wide range of algorithms for processing vertex color in a photoshop-like mode (changing for example contrast, white balance, gamma) Basic Tools for mapping quality into a color according to standard color ramps are here.
typedef MeshType::CoordType vcg::tri::UpdateColor< MeshType >::CoordType |
typedef MeshType::EdgeIterator vcg::tri::UpdateColor< MeshType >::EdgeIterator |
typedef MeshType::FaceIterator vcg::tri::UpdateColor< MeshType >::FaceIterator |
typedef MeshType::FacePointer vcg::tri::UpdateColor< MeshType >::FacePointer |
typedef MeshType::FaceType vcg::tri::UpdateColor< MeshType >::FaceType |
typedef MeshType::ScalarType vcg::tri::UpdateColor< MeshType >::ScalarType |
typedef MeshType::VertexIterator vcg::tri::UpdateColor< MeshType >::VertexIterator |
typedef MeshType::VertexPointer vcg::tri::UpdateColor< MeshType >::VertexPointer |
typedef MeshType::VertexType vcg::tri::UpdateColor< MeshType >::VertexType |
enum vcg::tri::UpdateColor::DesaturationMethods |
enum vcg::tri::UpdateColor::rgbChMask |
static Color4b vcg::tri::UpdateColor< MeshType >::ColorApplyDiff | ( | Color4b | old_color, |
Color4b | new_color, | ||
float | intensity | ||
) | [inline, static] |
static Color4b vcg::tri::UpdateColor< MeshType >::ColorBrightnessContrast | ( | Color4b | c, |
float | brightness, | ||
float | contrast | ||
) | [inline, static] |
static Color4b vcg::tri::UpdateColor< MeshType >::ColorDesaturate | ( | Color4b | c, |
int | method | ||
) | [inline, static] |
static Color4b vcg::tri::UpdateColor< MeshType >::ColorEqualize | ( | Color4b | c, |
int | cdf_l[256], | ||
int | cdf_r[256], | ||
int | cdf_g[256], | ||
int | cdf_b[256], | ||
unsigned int | rgbMask | ||
) | [inline, static] |
static Color4b vcg::tri::UpdateColor< MeshType >::ColorLevels | ( | Color4b | c, |
float | gamma, | ||
float | in_min, | ||
float | in_max, | ||
float | out_min, | ||
float | out_max, | ||
unsigned char | rgbMask | ||
) | [inline, static] |
static Color4b vcg::tri::UpdateColor< MeshType >::ColorMul | ( | Color4b | c, |
float | factor | ||
) | [inline, static] |
static Color4b vcg::tri::UpdateColor< MeshType >::ColorPow | ( | Color4b | c, |
float | exponent | ||
) | [inline, static] |
static Color4b vcg::tri::UpdateColor< MeshType >::ColorWhiteBalance | ( | Color4b | c, |
Color4b | unbalancedWhite | ||
) | [inline, static] |
static float vcg::tri::UpdateColor< MeshType >::ComputeAvgLightness | ( | Color4b | c | ) | [inline, static] |
static float vcg::tri::UpdateColor< MeshType >::ComputeLightness | ( | Color4b | c | ) | [inline, static] |
static float vcg::tri::UpdateColor< MeshType >::ComputeLuminosity | ( | Color4b | c | ) | [inline, static] |
static void vcg::tri::UpdateColor< MeshType >::PerEdgeQualityRamp | ( | MeshType & | m, |
float | minq = 0 , |
||
float | maxq = 0 , |
||
bool | selected = false |
||
) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::PerFaceConstant | ( | MeshType & | m, |
Color4b | vs = Color4b::White , |
||
bool | selected = false |
||
) | [inline, static] |
static void vcg::tri::UpdateColor< MeshType >::PerFaceFromVertex | ( | MeshType & | m | ) | [inline, static] |
static void vcg::tri::UpdateColor< MeshType >::PerFaceQualityGray | ( | MeshType & | m, |
float | minq = 0 , |
||
float | maxq = 0 |
||
) | [inline, static] |
static void vcg::tri::UpdateColor< MeshType >::PerFaceQualityRamp | ( | MeshType & | m, |
float | minq = 0 , |
||
float | maxq = 0 , |
||
bool | selected = false |
||
) | [inline, static] |
static void vcg::tri::UpdateColor< MeshType >::PerFaceRandom | ( | MeshType & | m | ) | [inline, static] |
static void vcg::tri::UpdateColor< MeshType >::PerFaceRandomConnectedComponent | ( | MeshType & | m | ) | [inline, static] |
static void vcg::tri::UpdateColor< MeshType >::PerVertexAddNoise | ( | MeshType & | m, |
int | noiseBits, | ||
bool | onSelected = false |
||
) | [inline, static] |
static void vcg::tri::UpdateColor< MeshType >::PerVertexBorderFlag | ( | MeshType & | m, |
Color4b | BorderColor = Color4b::Blue , |
||
Color4b | InternalColor = Color4b::White , |
||
Color4b | MixColor = Color4b::Cyan |
||
) | [inline, static] |
Color the vertexes of the mesh that are on the border.
It uses the information in the Vertex flags, and not necessarily any topology. So it just require that you have correctly computed the flags; one way could be the following one:
static int vcg::tri::UpdateColor< MeshType >::PerVertexBrightness | ( | MeshType & | m, |
float | amount, | ||
const bool | ProcessSelected = false |
||
) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::PerVertexBrightnessContrast | ( | MeshType & | m, |
float | brightness, | ||
float | contrast, | ||
const bool | ProcessSelected = false |
||
) | [inline, static] |
Apply Brightness and Contrast filter to the mesh, with the given contrast factor and brightness amount.
Performs contrast and brightness operations on color, i.e NewValue = (OldValue - 128) * contrast + 128 + amount The result is clamped just one time after all computations; this get a more accurate result.
The formula used here is the one of GIMP.
static int vcg::tri::UpdateColor< MeshType >::PerVertexColourisation | ( | MeshType & | m, |
Color4b | c, | ||
float | intensity, | ||
const bool | ProcessSelected = false |
||
) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::PerVertexConstant | ( | MeshType & | m, |
Color4b | vs = Color4b::White , |
||
bool | selected = false |
||
) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::PerVertexContrast | ( | MeshType & | m, |
float | factor, | ||
const bool | ProcessSelected = false |
||
) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::PerVertexDesaturation | ( | MeshType & | m, |
int | method, | ||
const bool | ProcessSelected = false |
||
) | [inline, static] |
Desaturates the mesh according the a chosen desaturation method.
There are three possibilities
M_LIGHTNESS
where lightness = 0.5*(Max(R,G,B)+Min(R,G,B))M_LUMINOSITY
where luminosity = 0.21*R+0.71*G+0.7*BM_AVERAGE
Plain Average static int vcg::tri::UpdateColor< MeshType >::PerVertexEqualize | ( | MeshType & | m, |
unsigned int | rgbMask, | ||
const bool | ProcessSelected = false |
||
) | [inline, static] |
static void vcg::tri::UpdateColor< MeshType >::PerVertexFromFace | ( | MeshType & | m | ) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::PerVertexGamma | ( | MeshType & | m, |
float | gamma, | ||
const bool | ProcessSelected = false |
||
) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::PerVertexInvert | ( | MeshType & | m, |
const bool | ProcessSelected = false |
||
) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::PerVertexLevels | ( | MeshType & | m, |
float | gamma, | ||
float | in_min, | ||
float | in_max, | ||
float | out_min, | ||
float | out_max, | ||
unsigned char | rgbMask, | ||
const bool | ProcessSelected = false |
||
) | [inline, static] |
Adjusts color levels of the mesh.
Adjusts color levels of the mesh. Filter can be applied to all RGB channels or to each channel separately. in_min, gamma and in_max are respectively the black point, the gray point and the white point. out_min and out_max are the output level for black and white respectively.
static void vcg::tri::UpdateColor< MeshType >::PerVertexPerlinNoise | ( | MeshType & | m, |
CoordType | period, | ||
CoordType | offset = CoordType(0, 0, 0) , |
||
bool | onSelected = false |
||
) | [inline, static] |
Perlin Noise.
Simple Perlin noise. To make things weirder each color band can have its own offset and frequency. Period is expressed in absolute terms. So as period it is meaningful could be to use something in the range of 1/10 of the bbox diag.
static void vcg::tri::UpdateColor< MeshType >::PerVertexQualityGray | ( | MeshType & | m, |
float | minq, | ||
float | maxq | ||
) | [inline, static] |
static void vcg::tri::UpdateColor< MeshType >::PerVertexQualityRamp | ( | MeshType & | m, |
float | minq = 0 , |
||
float | maxq = 0 |
||
) | [inline, static] |
static void vcg::tri::UpdateColor< MeshType >::PerVertexQualityRampParula | ( | MeshType & | m, |
float | minq = 0 , |
||
float | maxq = 0 |
||
) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::PerVertexThresholding | ( | MeshType & | m, |
float | threshold, | ||
Color4b | c1 = Color4<unsigned char>::Black , |
||
Color4b | c2 = Color4<unsigned char>::White , |
||
const bool | ProcessSelected = false |
||
) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::PerVertexWhiteBalance | ( | MeshType & | m, |
Color4b | userColor, | ||
const bool | ProcessSelected = false |
||
) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::ValueApplyDiff | ( | int | old_value, |
int | new_value, | ||
float | intensity | ||
) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::ValueBrightnessContrast | ( | unsigned char | ivalue, |
float | brightness, | ||
float | contrast | ||
) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::ValueEqualize | ( | int | cdfValue, |
int | cdfMin, | ||
int | cdfMax | ||
) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::ValueLevels | ( | int | value, |
float | gamma, | ||
float | in_min, | ||
float | in_max, | ||
float | out_min, | ||
float | out_max | ||
) | [inline, static] |
static int vcg::tri::UpdateColor< MeshType >::ValueMul | ( | int | value, |
float | factor | ||
) | [inline, static] |
static float vcg::tri::UpdateColor< MeshType >::ValuePow | ( | float | value, |
float | exponent | ||
) | [inline, static] |