Classes | Public Types | Static Public Member Functions
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>

List of all members.

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)

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 53 of file color.h.


Member Typedef Documentation

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

Definition at line 65 of file color.h.

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

Definition at line 62 of file color.h.

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

Definition at line 61 of file color.h.

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

Definition at line 60 of file color.h.

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

Definition at line 59 of file color.h.

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

Definition at line 64 of file color.h.

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

Definition at line 58 of file color.h.

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

Definition at line 57 of file color.h.

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

Definition at line 56 of file color.h.


Member Enumeration Documentation

template<class MeshType >
enum vcg::tri::UpdateColor::DesaturationMethods
Enumerator:
M_LIGHTNESS 
M_LUMINOSITY 
M_AVERAGE 

Definition at line 718 of file color.h.

template<class MeshType >
enum vcg::tri::UpdateColor::rgbChMask
Enumerator:
ALL_CHANNELS 
RED_CHANNEL 
GREEN_CHANNEL 
BLUE_CHANNEL 
NO_CHANNELS 

Definition at line 623 of file color.h.


Member Function Documentation

template<class MeshType >
static Color4b vcg::tri::UpdateColor< MeshType >::ColorApplyDiff ( Color4b  old_color,
Color4b  new_color,
float  intensity 
) [inline, static]

Definition at line 705 of file color.h.

template<class MeshType >
static Color4b vcg::tri::UpdateColor< MeshType >::ColorBrightnessContrast ( Color4b  c,
float  brightness,
float  contrast 
) [inline, static]

Definition at line 543 of file color.h.

template<class MeshType >
static Color4b vcg::tri::UpdateColor< MeshType >::ColorDesaturate ( Color4b  c,
int  method 
) [inline, static]

Definition at line 750 of file color.h.

template<class MeshType >
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]

Definition at line 837 of file color.h.

template<class MeshType >
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]

Definition at line 654 of file color.h.

template<class MeshType >
static Color4b vcg::tri::UpdateColor< MeshType >::ColorMul ( Color4b  c,
float  factor 
) [inline, static]

Definition at line 505 of file color.h.

template<class MeshType >
static Color4b vcg::tri::UpdateColor< MeshType >::ColorPow ( Color4b  c,
float  exponent 
) [inline, static]

Definition at line 608 of file color.h.

template<class MeshType >
static Color4b vcg::tri::UpdateColor< MeshType >::ColorWhiteBalance ( Color4b  c,
Color4b  unbalancedWhite 
) [inline, static]

Definition at line 886 of file color.h.

template<class MeshType >
static float vcg::tri::UpdateColor< MeshType >::ComputeAvgLightness ( Color4b  c) [inline, static]

Definition at line 770 of file color.h.

template<class MeshType >
static float vcg::tri::UpdateColor< MeshType >::ComputeLightness ( Color4b  c) [inline, static]

Definition at line 448 of file color.h.

template<class MeshType >
static float vcg::tri::UpdateColor< MeshType >::ComputeLuminosity ( Color4b  c) [inline, static]

Definition at line 776 of file color.h.

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

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 232 of file color.h.

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

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

Definition at line 97 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerFaceFromVertex ( MeshType &  m) [inline, static]

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

Definition at line 152 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerFaceQualityGray ( MeshType &  m,
float  minq = 0,
float  maxq = 0 
) [inline, static]

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 271 of file color.h.

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

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 212 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerFaceRandom ( MeshType &  m) [inline, static]

This function colores the face of a mesh randomly.

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

Definition at line 349 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerFaceRandomConnectedComponent ( MeshType &  m) [inline, static]

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 327 of file color.h.

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

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 402 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 
) [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:

Definition at line 297 of file color.h.

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

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

Definition at line 457 of file color.h.

template<class MeshType >
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.

Definition at line 523 of file color.h.

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

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 682 of file color.h.

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

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

Definition at line 79 of file color.h.

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

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

Definition at line 483 of file color.h.

template<class MeshType >
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.

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 729 of file color.h.

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

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 786 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerVertexFromFace ( MeshType &  m) [inline, static]

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 117 of file color.h.

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

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 586 of file color.h.

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

Invert the colors of the mesh.

Returns:
the number of changed vertexes (the selected ones)

Definition at line 563 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 
) [inline, static]

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 633 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 
) [inline, static]

Perlin Noise.

Returns:
the number of changed vertexes (the selected ones)

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 377 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerVertexQualityGray ( MeshType &  m,
float  minq,
float  maxq 
) [inline, static]

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 252 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerVertexQualityRamp ( MeshType &  m,
float  minq = 0,
float  maxq = 0 
) [inline, static]

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 171 of file color.h.

template<class MeshType >
static void vcg::tri::UpdateColor< MeshType >::PerVertexQualityRampParula ( MeshType &  m,
float  minq = 0,
float  maxq = 0 
) [inline, static]

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 192 of file color.h.

template<class MeshType >
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]

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

Definition at line 424 of file color.h.

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

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 862 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::ValueApplyDiff ( int  old_value,
int  new_value,
float  intensity 
) [inline, static]

Definition at line 712 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::ValueBrightnessContrast ( unsigned char  ivalue,
float  brightness,
float  contrast 
) [inline, static]

Definition at line 550 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::ValueEqualize ( int  cdfValue,
int  cdfMin,
int  cdfMax 
) [inline, static]

Definition at line 852 of file color.h.

template<class MeshType >
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]

Definition at line 664 of file color.h.

template<class MeshType >
static int vcg::tri::UpdateColor< MeshType >::ValueMul ( int  value,
float  factor 
) [inline, static]

Definition at line 510 of file color.h.

template<class MeshType >
static float vcg::tri::UpdateColor< MeshType >::ValuePow ( float  value,
float  exponent 
) [inline, static]

Definition at line 617 of file color.h.


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


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:43:23