VCG Library
Static Public Member Functions | List of all members
vcg::tri::UpdateColor< MeshType > Class Template Reference

Generation and processing of per-vertex and per-face colors according to various strategy. More...

#include <vcg/complex/algorithms/update/color.h>

Static Public Member Functions

static int PerVertexConstant (MeshType &m, Color4b vs=Color4b::White, bool selected=false)
 This function colors all (or the selected) the vertices of a mesh.
 
static int PerFaceConstant (MeshType &m, Color4b vs=Color4b::White, bool selected=false)
 This function colors all (or the selected) faces of a mesh.
 
static int PerTetraConstant (MeshType &m, Color4b vs=Color4b::White, bool selected=false)
 This function colors all (or the selected) tetras of a mesh.
 
static void PerVertexFromTetra (MeshType &m)
 Transfer tetra color onto vertex color.
 
static void PerVertexFromFace (MeshType &m)
 Transfer face color onto vertex color.
 
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 PerVertexQualityRamp (MeshType &m, ScalarType minq=0., ScalarType 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, ScalarType minq=0., ScalarType maxq=0.)
 This function colores all the faces of a mesh with a hue color shade dependent on the quality.
 
static void PerTetraQualityRamp (MeshType &m, ScalarType minq=0., ScalarType 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 PerFaceQualityRamp (MeshType &m, ScalarType minq=0, ScalarType 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 PerEdgeQualityRamp (MeshType &m, ScalarType minq=0, ScalarType maxq=0, bool selected=false)
 This function colores all the edges of a mesh with a hue color shade dependent on the quality.
 
static void PerVertexQualityGray (MeshType &m, ScalarType minq=0, ScalarType maxq=0)
 This function colores all the vertices of a mesh with a gray shade dependent on the quality.
 
static void PerFaceQualityGray (MeshType &m, ScalarType minq=0, ScalarType maxq=0)
 This function colores all the faces of a mesh with a gray shade dependent on the quality.
 
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 void PerFaceRandomConnectedComponent (MeshType &m)
 This function colores the faces of connected components of a mesh randomly.
 
static void PerFaceRandom (MeshType &m)
 This function colores the face of a mesh randomly.
 
static void PerVertexPerlinNoise (MeshType &m, CoordType period, CoordType offset=CoordType(0, 0, 0), bool onSelected=false)
 Perlin Noise.
 
static void PerVertexPerlinColoring (MeshType &m, ScalarType period, CoordType offset=CoordType(0, 0, 0), Color4b color1=Color4b::Black, Color4b color2=Color4b::White, bool onSelected=false)
 Perlin Color mixing.
 
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 int PerVertexThresholding (MeshType &m, float threshold, const Color4b c1=Color4< unsigned char >::Black, const Color4b c2=Color4< unsigned char >::White, const bool ProcessSelected=false)
 Reduces vertex color the mesh to two colors according to a threshold.
 
static int PerVertexBrightness (MeshType &m, float amount, const bool ProcessSelected=false)
 Apply the brightness filter, with the given amount, to the 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 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 PerVertexInvert (MeshType &m, const bool ProcessSelected=false)
 Invert the colors of the mesh.
 
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 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 int PerVertexColourisation (MeshType &m, Color4b c, float intensity, const bool ProcessSelected=false)
 Colorize the mesh toward a given color.
 
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 int PerVertexWhiteBalance (MeshType &m, Color4b userColor, const bool ProcessSelected=false)
 Simple white balancing filter.
 

Detailed Description

template<class MeshType>
class vcg::tri::UpdateColor< MeshType >

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.

Definition at line 52 of file color.h.

Member Function Documentation

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerEdgeQualityRamp ( MeshType &  m,
ScalarType  minq = 0,
ScalarType  maxq = 0,
bool  selected = false 
)
inlinestatic

This function colores all the edges of a mesh with a hue color shade dependent on the quality.

If no range of quality is passed it is automatically computed.

Definition at line 306 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::PerFaceConstant ( MeshType &  m,
Color4b  vs = Color4b::White,
bool  selected = false 
)
inlinestatic

This function colors all (or the selected) faces of a mesh.

Definition at line 100 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerFaceFromVertex ( MeshType &  m)
inlinestatic

Transfer vertex color onto face color Plain average of the color of the vertexes on a given face.

Definition at line 204 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerFaceQualityGray ( MeshType &  m,
ScalarType  minq = 0,
ScalarType  maxq = 0 
)
inlinestatic

This function colores all the faces of a mesh with a gray shade dependent on the quality.

If no range of quality is passed it is automatically computed.

Definition at line 345 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerFaceQualityRamp ( MeshType &  m,
ScalarType  minq = 0,
ScalarType  maxq = 0,
bool  selected = false 
)
inlinestatic

This function colores all the faces of a mesh with a hue color shade dependent on the quality.

If no range of quality is passed it is automatically computed.

Definition at line 285 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerFaceRandom ( MeshType &  m)
inlinestatic

This function colores the face of a mesh randomly.

Note: The faux bit is used to color polygonal faces uniformly

Definition at line 423 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerFaceRandomConnectedComponent ( MeshType &  m)
inlinestatic

This function colores the faces of connected components of a mesh randomly.

It require FaceFace Adjacency becouse it relies on the output of the ConnecteComponents();

Definition at line 401 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::PerTetraConstant ( MeshType &  m,
Color4b  vs = Color4b::White,
bool  selected = false 
)
inlinestatic

This function colors all (or the selected) tetras of a mesh.

Definition at line 117 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerTetraQualityRamp ( MeshType &  m,
ScalarType  minq = 0.,
ScalarType  maxq = 0.,
bool  selected = false 
)
inlinestatic

This function colores all the faces of a mesh with a hue color shade dependent on the quality.

If no range of quality is passed it is automatically computed.

Definition at line 264 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerVertexAddNoise ( MeshType &  m,
int  noiseBits,
bool  onSelected = false 
)
inlinestatic

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).

Definition at line 503 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerVertexBorderFlag ( MeshType &  m,
Color4b  BorderColor = Color4b::Blue,
Color4b  InternalColor = Color4b::White,
Color4b  MixColor = Color4b::Cyan 
)
inlinestatic

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:

Definition at line 371 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::PerVertexBrightness ( MeshType &  m,
float  amount,
const bool  ProcessSelected = false 
)
inlinestatic

Apply the brightness filter, with the given amount, to the mesh.

Definition at line 558 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::PerVertexBrightnessContrast ( MeshType &  m,
float  brightness,
float  contrast,
const bool  ProcessSelected = false 
)
inlinestatic

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.

Definition at line 624 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::PerVertexColourisation ( MeshType &  m,
Color4b  c,
float  intensity,
const bool  ProcessSelected = false 
)
inlinestatic

Colorize the mesh toward a given color.

Returns
the number of changed vertexes (the selected ones)

Colors the mesh. Color is blended to the mesh with the given intensity (0..1 ranged).

Definition at line 783 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::PerVertexConstant ( MeshType &  m,
Color4b  vs = Color4b::White,
bool  selected = false 
)
inlinestatic

This function colors all (or the selected) the vertices of a mesh.

Definition at line 82 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::PerVertexContrast ( MeshType &  m,
float  factor,
const bool  ProcessSelected = false 
)
inlinestatic

Apply Contrast filter to the mesh with the given contrast factor.

Definition at line 584 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::PerVertexDesaturation ( MeshType &  m,
int  method,
const bool  ProcessSelected = false 
)
inlinestatic

Desaturates the mesh according the a chosen desaturation method.

Returns
the number of changed vertexes (the selected ones)

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*B
  • M_AVERAGE Plain Average

Definition at line 830 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::PerVertexEqualize ( MeshType &  m,
unsigned int  rgbMask,
const bool  ProcessSelected = false 
)
inlinestatic

Histogram Color Equalization.

Returns
the number of changed vertexes (the selected ones)

Equalize the histogram of colors. It can equalize any combination of rgb channels or it can work on lightness.

Definition at line 888 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerVertexFromFace ( MeshType &  m)
inlinestatic

Transfer face color onto vertex color.

Plain average of the color of the faces incident on a given vertex. No adjacency required.

Definition at line 169 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerVertexFromTetra ( MeshType &  m)
inlinestatic

Transfer tetra color onto vertex color.

Plain average of the color of the tetras incident on a given vertex. No adjacency required.

Definition at line 136 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::PerVertexGamma ( MeshType &  m,
float  gamma,
const bool  ProcessSelected = false 
)
inlinestatic

Apply the gamma correction filter, with the given gamma exponet, to the mesh.

Returns
the number of changed vertexes (the selected ones)

Definition at line 687 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::PerVertexInvert ( MeshType &  m,
const bool  ProcessSelected = false 
)
inlinestatic

Invert the colors of the mesh.

Returns
the number of changed vertexes (the selected ones)

Definition at line 664 of file color.h.

template<class MeshType >
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 
)
inlinestatic

Adjusts color levels of the mesh.

Returns
the number of changed vertexes (the selected ones)

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.

Definition at line 734 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerVertexPerlinColoring ( MeshType &  m,
ScalarType  period,
CoordType  offset = CoordType(0, 0, 0),
Color4b  color1 = Color4b::Black,
Color4b  color2 = Color4b::White,
bool  onSelected = false 
)
inlinestatic

Perlin Color mixing.

Simple Perlin color mixing. Color 1 and 2 are mixed according the perlin noise function, with period and offset.

Definition at line 477 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerVertexPerlinNoise ( MeshType &  m,
CoordType  period,
CoordType  offset = CoordType(0, 0, 0),
bool  onSelected = false 
)
inlinestatic

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.

Definition at line 450 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerVertexQualityGray ( MeshType &  m,
ScalarType  minq = 0,
ScalarType  maxq = 0 
)
inlinestatic

This function colores all the vertices of a mesh with a gray shade dependent on the quality.

If no range of quality is passed it is automatically computed.

Definition at line 326 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerVertexQualityRamp ( MeshType &  m,
ScalarType  minq = 0.,
ScalarType  maxq = 0. 
)
inlinestatic

This function colores all the faces of a mesh with a hue color shade dependent on the quality.

If no range of quality is passed it is automatically computed.

Definition at line 223 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerVertexQualityRampParula ( MeshType &  m,
ScalarType  minq = 0.,
ScalarType  maxq = 0. 
)
inlinestatic

This function colores all the faces of a mesh with a hue color shade dependent on the quality.

If no range of quality is passed it is automatically computed.

Definition at line 244 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::PerVertexThresholding ( MeshType &  m,
float  threshold,
const Color4b  c1 = Color4<unsigned char>::Black,
const Color4b  c2 = Color4<unsigned char>::White,
const bool  ProcessSelected = false 
)
inlinestatic

Reduces vertex color the mesh to two colors according to a threshold.

Definition at line 525 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::PerVertexWhiteBalance ( MeshType &  m,
Color4b  userColor,
const bool  ProcessSelected = false 
)
inlinestatic

Simple white balancing filter.

Returns
the number of changed vertexes (the selected ones)

It applies a simple white balancing filter. It may works on a provided user color that is supposed to be white.

Definition at line 964 of file color.h.


The documentation for this class was generated from the following file: