ColorOps.H File Reference

#include "Image/Image.H"
#include "Util/Assert.H"
#include "Util/Promotions.H"
Include dependency graph for ColorOps.H:

Go to the source code of this file.

Functions

template<class T >
Image< PixRGB< T > > makeRGB (const Image< T > &red, const Image< T > &green, const Image< T > &blue)
 Set the red, green and blue components from 3 monochromatic images.
Image< PixRGB< byte > > colorize (const Image< byte > &img, const ColorMap &cmap)
 Colorize a greyscale byte image using a colormap.
void inplaceColorSpeckleNoise (Image< PixRGB< byte > > &dest, const int num)
 Add color speckle noise to array; faster version, draws 'num' dots.
template<class T >
void getComponents (const Image< PixRGB< T > > &src, Image< T > &red, Image< T > &green, Image< T > &blue)
 Get the red, green and blue components as 3 monochromatic images.
template<class PixT >
Image< typename PixT::ScalarType > getPixelComponentImage (const Image< PixT > &in, const size_t i)
 Split out a single pixel component image from a multispectral pixel input image.
Image< PixRGB< float > > normalizeRGPolar (const Image< float > &src, const float max, const float min)
Image< PixRGB< float > > normalizeRGPolarAuto (const Image< float > &src)
Image< PixRGB< float > > normalizeWithScale (const Image< float > &src, const float min, const float max, const float clamp, const char baseColor, const char normColor)
 Normalize a grey scale image, with some idea for scale.
Image< PixRGB< float > > normalizeScaleRainbow (const Image< float > &src, const float min, const float max)
 Normalize a grey scale image, with some idea for scale.
template<class T >
Image< PixRGB< T > > stain (const Image< T > &src, PixRGB< float > color)
 Create a color image by staining a monochrome image.
Image< PixRGB< float > > stainPosNeg (const Image< float > &src, const float maxval, const PixRGB< float > &background, const PixRGB< float > &pos_stain, const PixRGB< float > &neg_stain)
 Create a color image from src by tinting positive and negative values.
Image< PixRGB< float > > overlayStain (const Image< float > &top, const Image< float > &bottom, const float trans, const char channel)
 Overlay an image over another, however, stain the top image.
template<class T >
void getMinMaxC (const Image< PixRGB< T > > &src, T &mi, T &ma)
 Get min and max of the components.
template<class T >
PixRGB< float > meanRGB (const Image< PixRGB< T > > &src)
 Get the mean RGB of an Image.
template<class T , class T2 >
void normalizeC (Image< PixRGB< T > > &src, const T2 nmin, const T2 nmax)
 Normalize values between nmin and nmax.
template<class T >
Image< T > luminance (const Image< PixRGB< T > > &src)
 Compute luminance of a color image.
template<class T >
Image< T > luminance (const Image< T > &src)
 Compute luminance of a greyscale image (no-op).
template<class T >
Image< T > luminanceNTSC (const Image< PixRGB< T > > &src)
 Compute luminance in NTSC coordinates.
template<class T >
Image< PixRGB< T > > toRGB (const Image< T > &src)
 Convert grayscale image to RGB.
template<class T >
Image< PixRGB< T > > toRGB (const Image< PixRGB< T > > &src)
 Convert RGB image to RGB (no-op).
template<class T >
Image< float > infoMeasure (const Image< PixRGB< T > > &src, const float eps, const int size)
 Compute color information measure based in infoFFT.
template<class T >
void getYIQ (const Image< PixRGB< T > > &src, Image< T > &y, Image< T > &i, Image< T > &q)
 Get YIQ color components.
template<class T >
void getJpegYUV (const Image< PixRGB< T > > &src, Image< T > &y, Image< T > &u, Image< T > &v)
 Get YUV color components from an RGB image.
template<class T >
Image< PixRGB< T > > luminanceNormalize (const Image< PixRGB< T > > &src, const T thresh)
 Normalize my values by those in the lum image.
template<class T >
void getRGBY (const Image< PixRGB< T > > &src, Image< typename promote_trait< T, float >::TP > &rg, Image< typename promote_trait< T, float >::TP > &by, const typename promote_trait< T, float >::TP thresh)
 Compute R/G and B/Y channels from a luminanceNormalized color image.
template<class T >
void getRGBYsimple (const Image< PixRGB< T > > &src, Image< typename promote_trait< T, float >::TP > &rg, Image< typename promote_trait< T, float >::TP > &by, const typename promote_trait< T, float >::TP thresh)
 Compute R/G and B/Y channels in a simpler way.
template<class T >
void getRGBY (const Image< PixRGB< T > > &src, Image< T > &r, Image< T > &g, Image< T > &b, Image< T > &y, const T thresh)
 Compute R, G, B, Y channels from a luminanceNormalized color image.
template<class T >
void getRGBY (const Image< PixRGB< T > > &src, Image< T > &rg, Image< T > &by, Image< T > &sat, Image< T > &val, const ushort H2SVtype=2)
 Compute R/G and B/Y via computation of H2SV2 color space.
template<class T >
void getDKL (const Image< PixRGB< T > > &src, Image< typename promote_trait< T, float >::TP > &dimg, Image< typename promote_trait< T, float >::TP > &kimg, Image< typename promote_trait< T, float >::TP > &limg)
 Compute D, K, L color components from an RGB image.
template<class T >
void getLAB (const Image< PixRGB< T > > &src, Image< typename promote_trait< T, float >::TP > &limg, Image< typename promote_trait< T, float >::TP > &aimg, Image< typename promote_trait< T, float >::TP > &bimg)
 Compute L, A, B color components from an RGB image.
void normalizeLAB (Image< float > &limg, Image< float > &aimg, Image< float > &bimg)
template<class T >
void getNormalizedLAB (const Image< PixRGB< T > > &src, Image< typename promote_trait< T, float >::TP > &limg, Image< typename promote_trait< T, float >::TP > &aimg, Image< typename promote_trait< T, float >::TP > &bimg)
 just call getLAB and normalizeLAB
Image< PixRGB< byte > > contrastModulate (const Image< PixRGB< byte > > &img, const Image< float > &mask, float baseContrast=0.05, byte baseBright=255)
 contrast-modulate an RGB image with a mask
template<class T >
double pSNRcolor (const Image< PixRGB< T > > &img1, const Image< PixRGB< T > > &img2)
 Compute peak signal-to-noise ratio between two color images.
template<class T >
double pSNRcolor (const Image< PixRGB< T > > &img1, const Image< PixRGB< T > > &img2, const Image< float > &weight)
 Compute weighted peak signal-to-noise ratio between two color images.
template<class T >
Image< PixRGB< T > > normalizeRGB (const Image< PixRGB< T > > &img, PixRGB< T > min, PixRGB< T > max)
 Normalize each component of the RGB image separately.
template<class T >
Image< T > maxRGB (const Image< PixRGB< T > > &img)
 Return the pixel-wise maximum of the r, g and b component.
template<class T >
Image< PixRGB< T > > colorStain (const Image< T > &src, const T &min, const T &max, const PixRGB< T > &color)
 Stain a black and white image with a color.
void RGBtoCIE (const PixRGB< byte > &rgbColor, float &cr, float &cg, float &intens)
 convert RGB color values into C.I.E. coordinates
Image< float > hueDistance (const Image< PixRGB< byte > > &img, float muR, float muG, float sigR, float sigG, float rho)
 distance between hue of image pixels and a given hue

Detailed Description

Color operations on Image

Definition in file ColorOps.H.


Function Documentation

Image< PixRGB<byte> > colorize ( const Image< byte > &  img,
const ColorMap cmap 
)

Colorize a greyscale byte image using a colormap.

Note that this will throw a fatal error if the colormap does not have exactly 256 entries.

Definition at line 85 of file ColorOps.C.

References Image< T >::begin(), Image< T >::end(), Image< T >::getDims(), Image< T >::getWidth(), and NO_INIT.

Referenced by ColorizeOfilt::filterFrame(), and formatMapForDisplay().

template<class T >
Image< PixRGB<T> > colorStain ( const Image< T > &  src,
const T &  min,
const T &  max,
const PixRGB< T > &  color 
) [inline]

Stain a black and white image with a color.

Parameters:
src the black and white image to be stained
min This value will be converted to 0 (black)
max This value will be converted to color
color The color used for staining

Definition at line 1063 of file ColorOps.C.

References ASSERT, Image< T >::begin(), Image< T >::end(), Image< T >::getDims(), and NO_INIT.

Referenced by main().

Image< PixRGB<byte> > contrastModulate ( const Image< PixRGB< byte > > &  img,
const Image< float > &  mask,
float  baseContrast = 0.05,
byte  baseBright = 255 
)

contrast-modulate an RGB image with a mask

Definition at line 980 of file ColorOps.C.

References ASSERT, inplaceClamp(), and inplaceNormalize().

Referenced by SimulationViewerStd::getTraj().

template<class T >
void getComponents ( const Image< PixRGB< T > > &  src,
Image< T > &  red,
Image< T > &  green,
Image< T > &  blue 
) [inline]

Get the red, green and blue components as 3 monochromatic images.

Definition at line 122 of file ColorOps.C.

References ASSERT, Image< T >::beginw(), and NO_INIT.

Referenced by RGBConvolvePyrBuilder< T >::build(), RGBConvolvePyrBuilder< T >::build2(), ImagizeColorChannel::doInput(), SplitRgbOfilt::filterFrame(), maxRGB(), normalizeRGB(), and pSNRcolor().

template<class T >
void getDKL ( const Image< PixRGB< T > > &  src,
Image< typename promote_trait< T, float >::TP > &  dimg,
Image< typename promote_trait< T, float >::TP > &  kimg,
Image< typename promote_trait< T, float >::TP > &  limg 
) [inline]

Compute D, K, L color components from an RGB image.

The DKL color space is motivated by the neurobiology of early vision in primates. D is roughly like luminance (with some neutral grey (RGB=[161 159 154]) at zero, white around 1.0, and black around -1.0), K roughly like Red-Green, and L roughly like Blue-Yellow. The images returned here have signed float values roughly in [-1,1] (but they sometimes are slightly larger that exactly that, so be sure to clamp if you ar egoing to convert).

Definition at line 835 of file ColorOps.C.

References ASSERT, Image< T >::beginw(), PixDKL< T >::D(), Image< T >::end(), PixDKL< T >::K(), PixDKL< T >::L(), and NO_INIT.

Referenced by DKLcolorChannel::doInput().

template<class T >
void getJpegYUV ( const Image< PixRGB< T > > &  src,
Image< T > &  y,
Image< T > &  u,
Image< T > &  v 
) [inline]

Get YUV color components from an RGB image.

Definition at line 571 of file ColorOps.C.

References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::end(), NO_INIT, PixJpegYUV< T >::U(), PixJpegYUV< T >::V(), and PixJpegYUV< T >::Y().

template<class T >
void getLAB ( const Image< PixRGB< T > > &  src,
Image< typename promote_trait< T, float >::TP > &  limg,
Image< typename promote_trait< T, float >::TP > &  aimg,
Image< typename promote_trait< T, float >::TP > &  bimg 
) [inline]

Compute L, A, B color components from an RGB image.

Derived from By Mark Ruzon from C code by Yossi Rubner, 23 September 1997 A Lab color space is a color-opponent space with dimension L for lightness and a and b for the color-opponent dimensions, based on nonlinearly compressed CIE XYZ color space coordinates. Lab color is designed to approximate human vision. It aspires to perceptual uniformity, and its L component closely matches human perception of lightness. It can thus be used to make accurate color balance corrections by modifying output curves in the a and b components, or to adjust the lightness contrast using the L component. In RGB or CMYK spaces, which model the output of physical devices rather than human visual perception, these transformations can only be done with the help of appropriate blend modes in the editing application.

Definition at line 862 of file ColorOps.C.

References ASSERT, B, Image< T >::beginw(), PixRGB< T >::blue(), Image< T >::end(), G, PixRGB< T >::green(), NO_INIT, R, PixRGB< T >::red(), and Y.

Referenced by LocalBinaryPatterns::colorSum(), ColorHist::createFeatureVector(), and getNormalizedLAB().

template<class T >
void getMinMaxC ( const Image< PixRGB< T > > &  src,
T &  mi,
T &  ma 
) [inline]

Get min and max of the components.

Definition at line 352 of file ColorOps.C.

References ASSERT.

Referenced by normalizeC(), normalizeFloatRgb(), and Raster::VisuRGB().

template<class T >
void getNormalizedLAB ( const Image< PixRGB< T > > &  src,
Image< typename promote_trait< T, float >::TP > &  limg,
Image< typename promote_trait< T, float >::TP > &  aimg,
Image< typename promote_trait< T, float >::TP > &  bimg 
) [inline]

just call getLAB and normalizeLAB

Definition at line 966 of file ColorOps.C.

References getLAB(), and normalizeLAB().

template<class PixT >
Image<typename PixT::ScalarType> getPixelComponentImage ( const Image< PixT > &  in,
const size_t  i 
) [inline]

Split out a single pixel component image from a multispectral pixel input image.

Definition at line 77 of file ColorOps.H.

References ASSERT, Image< T >::begin(), Image< T >::getDims(), and NO_INIT.

template<class T >
void getRGBY ( const Image< PixRGB< T > > &  src,
Image< T > &  rg,
Image< T > &  by,
Image< T > &  sat,
Image< T > &  val,
const ushort  H2SVtype = 2 
) [inline]

Compute R/G and B/Y via computation of H2SV2 color space.

In addition to returning R/G and B/Y this basically returns the full H2SV color space. the original RGB can be obtained later via conversion of rg,by, sat and val using a PixH2SV2 to RGB

Definition at line 795 of file ColorOps.C.

References ASSERT, Image< T >::beginw(), PixH2SV2< T >::H1(), PixH2SV1< T >::H1(), PixH2SV2< T >::H2(), PixH2SV1< T >::H2(), NO_INIT, PixH2SV1< T >::S(), PixH2SV2< T >::S(), PixH2SV1< T >::V(), and PixH2SV2< T >::V().

template<class T >
void getRGBY ( const Image< PixRGB< T > > &  src,
Image< T > &  r,
Image< T > &  g,
Image< T > &  b,
Image< T > &  y,
const T  thresh 
) [inline]

Compute R, G, B, Y channels from a luminanceNormalized color image.

This version keeps the four channels separate so that correct results can be obtained without requiring promotion even if the input is of type PixRGB<byte>

Definition at line 735 of file ColorOps.C.

References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::end(), lum, and NO_INIT.

template<class T >
void getRGBY ( const Image< PixRGB< T > > &  src,
Image< typename promote_trait< T, float >::TP > &  rg,
Image< typename promote_trait< T, float >::TP > &  by,
const typename promote_trait< T, float >::TP  thresh 
) [inline]

Compute R/G and B/Y channels from a luminanceNormalized color image.

This version does automatic promotion on the results, so that negative values can be represented even if the input is of type PixRGB<byte>

Definition at line 633 of file ColorOps.C.

References ASSERT, Image< T >::beginw(), Image< T >::end(), lum, and NO_INIT.

Referenced by RegSaliency::calcColor(), SaliencyMT::computeCMAP(), BeoSubSaliency::computeCMAP(), VisualObject::computeKeypoints(), SOColorChannel::doInput(), MultiConvolveChannel::doInput(), ColorChannel::doInput(), SaliencyMT::getBias(), main(), BeobotVisualCortex::masterProcess(), BeobotVisualCortex::singleCPUprocess(), and BeobotBrainMT::threadCompute().

template<class T >
void getRGBYsimple ( const Image< PixRGB< T > > &  src,
Image< typename promote_trait< T, float >::TP > &  rg,
Image< typename promote_trait< T, float >::TP > &  by,
const typename promote_trait< T, float >::TP  thresh 
) [inline]

Compute R/G and B/Y channels in a simpler way.

Params are as in getRGBY. The computation for the RG and BY maps is: RG = (R-G)/max(R,G,B); BY = (B-min(R,G))/max(R,G,B).

Definition at line 692 of file ColorOps.C.

References ASSERT, Image< T >::beginw(), Image< T >::end(), and NO_INIT.

Referenced by ColorChannel::doInput(), and main().

template<class T >
void getYIQ ( const Image< PixRGB< T > > &  src,
Image< T > &  y,
Image< T > &  i,
Image< T > &  q 
) [inline]

Get YIQ color components.

Definition at line 543 of file ColorOps.C.

References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::end(), getYIQ(), and NO_INIT.

Referenced by getYIQ(), and infoMeasure().

Image<float> hueDistance ( const Image< PixRGB< byte > > &  img,
float  muR,
float  muG,
float  sigR,
float  sigG,
float  rho 
)

distance between hue of image pixels and a given hue

Parameters:
img The color image to compare
muR the R/I coordinate of the target hue in the C.I.E. color space
muG the G/I coordinate in C.I.E.
sigR the standard deviation of a 2D Gaussian in R/I direction
sigG the standard deviation of a 2D Gaussian in G/I direction
rho the correlation between the R/I and G/I directions
Returns:
a float image coding for how close the hue in img is to the target hue - 1 for right on the mark, 0 for very different

Definition at line 1105 of file ColorOps.C.

References Image< T >::begin(), Image< T >::end(), exp(), NO_INIT, and RGBtoCIE().

Referenced by SaliencyMT::computeCMAP(), BeoSubSaliency::computeCMAP(), HueChannel::doInput(), and SaliencyMT::getBias().

template<class T >
Image<float> infoMeasure ( const Image< PixRGB< T > > &  src,
const float  eps,
const int  size 
) [inline]

Compute color information measure based in infoFFT.

Definition at line 503 of file ColorOps.C.

References ASSERT, countThresh(), dct(), decXY(), getYIQ(), lowPass3(), and NO_INIT.

Referenced by InformationChannel::doInput().

void inplaceColorSpeckleNoise ( Image< PixRGB< byte > > &  dest,
const int  num 
)

Add color speckle noise to array; faster version, draws 'num' dots.

Definition at line 103 of file ColorOps.C.

References ASSERT, randomUpToIncluding(), and randomUpToNotIncluding().

template<class T >
Image<T> luminance ( const Image< T > &  src  )  [inline]

Compute luminance of a greyscale image (no-op).

This no-op overload is provided so that luminance() can be applied to template images where it is not known whether the template argument is scalar or PixRGB.

Definition at line 447 of file ColorOps.C.

template<class T >
Image<T> luminance ( const Image< PixRGB< T > > &  src  )  [inline]

Compute luminance of a color image.

Definition at line 427 of file ColorOps.C.

References ASSERT, Image< T >::beginw(), Image< T >::endw(), and NO_INIT.

template<class T >
Image<PixRGB<T> > luminanceNormalize ( const Image< PixRGB< T > > &  src,
const T  thresh 
) [inline]

Normalize my values by those in the lum image.

Definition at line 598 of file ColorOps.C.

References ASSERT, Image< T >::beginw(), Image< T >::end(), and NO_INIT.

template<class T >
Image<T> luminanceNTSC ( const Image< PixRGB< T > > &  src  )  [inline]

Compute luminance in NTSC coordinates.

This version performs the same function as rgb2gray() in matlab

Definition at line 453 of file ColorOps.C.

References ASSERT, Image< T >::beginw(), Image< T >::endw(), and NO_INIT.

Referenced by GenericFrame::asGrayU8NTSCLayout(), and InferoTemporalHmax::attentionShift().

template<class T >
Image<PixRGB<T> > makeRGB ( const Image< T > &  red,
const Image< T > &  green,
const Image< T > &  blue 
) [inline]
template<class T >
Image<T> maxRGB ( const Image< PixRGB< T > > &  img  )  [inline]

Return the pixel-wise maximum of the r, g and b component.

Definition at line 1053 of file ColorOps.C.

References getComponents(), and takeMax().

template<class T >
PixRGB<float> meanRGB ( const Image< PixRGB< T > > &  src  )  [inline]

Get the mean RGB of an Image.

Definition at line 378 of file ColorOps.C.

References ASSERT, meanRGB(), and Pixels< T, dim >::p.

Referenced by meanRGB().

template<class T , class T2 >
void normalizeC ( Image< PixRGB< T > > &  src,
const T2  nmin,
const T2  nmax 
) [inline]

Normalize values between nmin and nmax.

Definition at line 193 of file ColorOps.H.

References ASSERT, and getMinMaxC().

void normalizeLAB ( Image< float > &  limg,
Image< float > &  aimg,
Image< float > &  bimg 
)

normalize the LAB color space to lie in [0.0, 1.0] this is more complex than just calling inplaceNormalize NOTE: we assume that this is called right getLAB separate calls usually are done if user wants both normalized and unnormalized value of the LAB color space

Definition at line 929 of file ColorOps.C.

References ASSERT, Image< T >::beginw(), Image< T >::endw(), and Image< T >::isSameSize().

Referenced by getNormalizedLAB().

template<class T >
Image< PixRGB<T> > normalizeRGB ( const Image< PixRGB< T > > &  img,
PixRGB< T >  min,
PixRGB< T >  max 
) [inline]

Normalize each component of the RGB image separately.

Normalize the red component with min.red() and max.red() etc.

Definition at line 1038 of file ColorOps.C.

References PixRGB< T >::blue(), getComponents(), PixRGB< T >::green(), inplaceNormalize(), makeRGB(), and PixRGB< T >::red().

Referenced by ScaleSurpriseControl< FLOAT >::SSCgetDiffImage(), and ScaleSurpriseControl< FLOAT >::SSCgetSeperableParts().

Image<PixRGB<float> > normalizeRGPolar ( const Image< float > &  src,
const float  max,
const float  min 
)

This method will normalize an image based upon the maximum value provided to it. This is either max or the absolute value of min. It then creates an image where all negative values are assigned a red pixel value while all postive numbers are assigned a green pixel value

Parameters:
max The maximum pixel value
min The minimum pixel value
image The image of values (positive and negative) to be processed

Definition at line 149 of file ColorOps.C.

References max(), and stainPosNeg().

Referenced by CINNIC::viewNeuronTemplate().

Image<PixRGB<float> > normalizeRGPolarAuto ( const Image< float > &  src  ) 

This method will normalize an image based upon the maximum value provided to it. This is either max or the absolute value of min. It then creates an image where all negative values are assigned a red pixel value while all postive numbers are assigned a green pixel value. This version will autmatically determine min and max and then normalize between 0 and 255 for red and green

Parameters:
image The image of values (positive and negative) to be processed

Definition at line 161 of file ColorOps.C.

References getMinMax(), max(), min(), and stainPosNeg().

Referenced by ScaleRemoveSurprise< FLOAT >::SRScomputeBayesFeatureBias(), ScaleRemoveSurprise< FLOAT >::SRSgetDiffParts(), ScaleRemoveSurprise< FLOAT >::SRSopenBayesFeatureBias(), and ScaleSurpriseControl< FLOAT >::SSCgetDiffParts().

Image<PixRGB<float> > normalizeScaleRainbow ( const Image< float > &  src,
const float  min,
const float  max 
)

Normalize a grey scale image, with some idea for scale.

Here we normalize the image using translation between RGB and HSV what we do is set the intensity as the basic normalized value of the original gray scale image. However, we use hue as the absolute scale. Saturation is constant at 100 (full).

Definition at line 208 of file ColorOps.C.

References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::end(), Image< T >::getHeight(), getMinMax(), Image< T >::getWidth(), Image< T >::initialized(), max(), min(), and Image< T >::resize().

Referenced by SurpriseControl< PIXTYPE, BETATYPE, FLOAT >::SCcomputeLocalBias(), SurpriseControl< PIXTYPE, BETATYPE, FLOAT >::SCcomputeNewBeta(), SurpriseControl< PIXTYPE, BETATYPE, FLOAT >::SCinputConspicMap(), and ScaleSurpriseControl< FLOAT >::SSCgetBiasParts().

Image<PixRGB<float> > normalizeWithScale ( const Image< float > &  src,
const float  min,
const float  max,
const float  clamp,
const char  baseColor,
const char  normColor 
)

Normalize a grey scale image, with some idea for scale.

nromalize a grey scale image, but to give an idea of the actual scale, we leave one channel as the orignal value and set the other the new value. This way, the intensity is still normalized over once channel so that you can make out the image features, but the hue change lets you know that the real intensity was very high.

Note: the output baseColor and normColor should be 1,2 or 3. They should also not be equal. These are which channel is set as the base and normalized channel representations.

Also Note: The base color will be clamped to between 0 and clamp so that it can still be displayed

Parameters:
src The orignal grey scale image
min The low bound on the normalization, for instance 0
max The high bound on the normalization, for instance 255
clamp clamp the baseColor to no more than this value
baseColor,1,2,3 ; R,G,B : which channel to not normalize out
normColor,1,2,3 ; R,G,B : which channel to normalize out

Definition at line 173 of file ColorOps.C.

References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::end(), Image< T >::getHeight(), getMinMax(), Image< T >::getWidth(), Image< T >::initialized(), max(), min(), and Image< T >::resize().

Image<PixRGB<float> > overlayStain ( const Image< float > &  top,
const Image< float > &  bottom,
const float  trans,
const char  channel 
)

Overlay an image over another, however, stain the top image.

This method works almost exactly like overlay except that the bottom image is stained (colored) red green or blue depending on whether char channel is set to r,g, or b

Definition at line 311 of file ColorOps.C.

References ASSERT, Image< T >::begin(), Image< T >::getDims(), Image< T >::isSameSize(), NO_INIT, PixRGB< T >::setBlue(), PixRGB< T >::setGreen(), and PixRGB< T >::setRed().

Referenced by contourRun::dumpEnergySigmoid().

template<class T >
double pSNRcolor ( const Image< PixRGB< T > > &  img1,
const Image< PixRGB< T > > &  img2,
const Image< float > &  weight 
) [inline]

Compute weighted peak signal-to-noise ratio between two color images.

This is like the other pSNRcolor() except that it uses the weighted version of distance() internally

Definition at line 1019 of file ColorOps.C.

References ASSERT, distance(), getComponents(), and log10().

template<class T >
double pSNRcolor ( const Image< PixRGB< T > > &  img1,
const Image< PixRGB< T > > &  img2 
) [inline]

Compute peak signal-to-noise ratio between two color images.

For color images, pSNR computed from the average mean-squared-error from the red, green and blue channels

Definition at line 1001 of file ColorOps.C.

References ASSERT, distance(), getComponents(), and log10().

void RGBtoCIE ( const PixRGB< byte > &  rgbColor,
float &  cr,
float &  cg,
float &  intens 
)

convert RGB color values into C.I.E. coordinates

Parameters:
rgbColor the color to convert from
cr returns the R/I value
cg returns the G/I value
intens returns the intensity

Definition at line 1086 of file ColorOps.C.

References PixRGB< T >::blue(), PixRGB< T >::green(), and PixRGB< T >::red().

Referenced by HueChannel::HueChannel(), and hueDistance().

template<class T >
Image<PixRGB<T> > stain ( const Image< T > &  src,
PixRGB< float >  color 
) [inline]

Create a color image by staining a monochrome image.

Each pixel in the result is given by the stain color multiplied by the corresponding pixel in the monochrome source image. This is entirely equivalent to, but more efficient than, creating a color image from the monochrome image, then multiplying the color image by the stain color.

Definition at line 256 of file ColorOps.C.

References Image< T >::begin(), Image< T >::getDims(), and NO_INIT.

Image<PixRGB<float> > stainPosNeg ( const Image< float > &  src,
const float  maxval,
const PixRGB< float > &  background,
const PixRGB< float > &  pos_stain,
const PixRGB< float > &  neg_stain 
)

Create a color image from src by tinting positive and negative values.

For each pixel x in the input image, we compute ratio=x/maxval; then if the ratio is positive, the output value is ratio*pos_stain + (1-ratio)*background, and if the ratio is negative, then the output value is (-ratio)*neg_stain + (1-(-ratio))*background.

Definition at line 276 of file ColorOps.C.

References Image< T >::begin(), Image< T >::getDims(), and NO_INIT.

Referenced by normalizeRGPolar(), and normalizeRGPolarAuto().

template<class T >
Image< PixRGB<T> > toRGB ( const Image< PixRGB< T > > &  src  )  [inline]

Convert RGB image to RGB (no-op).

This no-op function is provided so that toRGB() can be applied to template images where it is not known whether the template argument is scalar or PixRGB.

Definition at line 498 of file ColorOps.C.

template<class T >
Image< PixRGB<T> > toRGB ( const Image< T > &  src  )  [inline]
Generated on Sun May 8 08:12:36 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3