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

This graph shows which files directly or indirectly include this file:

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, 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. | |
| 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 | |
|
||||||||||||
|
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. |
|
||||||||||||||||||||||||
|
Stain a black and white image with a color.
Definition at line 918 of file ColorOps.C. References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::end(), Image< T >::getDims(), GVX_TRACE, NO_INIT, and lobot::stop(). Referenced by main(). |
|
||||||||||||||||||||
|
contrast-modulate an RGB image with a mask
|
|
||||||||||||||||||||||||
|
Get the red, green and blue components as 3 monochromatic images.
Definition at line 122 of file ColorOps.C. References ASSERT, Image< T >::beginw(), GVX_TRACE, NO_INIT, src, and lobot::stop(). Referenced by RGBConvolvePyrBuilder< T >::build(), RGBConvolvePyrBuilder< T >::build2(), ImagizeColorChannel::doInput(), SplitRgbOfilt::filterFrame(), main(), maxRGB(), normalizeRGB(), StatsOutputSeries::Impl::printStatsRGB(), pSNRcolor(), Raster_xx_img_gray_write_gray_read_rgb_xx_1(), Raster_xx_img_gray_write_rgb_read_rgb_xx_1(), and rectifyRgb(). |
|
||||||||||||||||||||||||
|
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 809 of file ColorOps.C. References ASSERT, PixDKL< T >::D(), GVX_TRACE, PixDKL< T >::K(), PixDKL< T >::L(), NO_INIT, p, src, and lobot::stop(). Referenced by DKLcolorChannel::doInput(). |
|
||||||||||||||||||||||||
|
Get YUV color components from an RGB image.
Definition at line 545 of file ColorOps.C. References ASSERT, Image< T >::beginw(), GVX_TRACE, NO_INIT, src, lobot::stop(), PixJpegYUV< T >::U(), PixJpegYUV< T >::V(), and PixJpegYUV< T >::Y(). |
|
||||||||||||||||||||
|
Get min and max of the components.
Definition at line 352 of file ColorOps.C. References ASSERT, GVX_TRACE, src, lobot::stop(), and x. Referenced by buildTitle(), normalizeC(), normalizeFloatRgb(), and Raster::VisuRGB(). |
|
||||||||||||||||
|
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 >::beginw(), Image< T >::endw(), Image< T >::getDims(), NO_INIT, and lobot::stop(). Referenced by segmentColor(). |
|
||||||||||||||||||||||||||||||||
|
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 769 of file ColorOps.C. References ASSERT, Image< T >::beginw(), GVX_TRACE, PixH2SV2< T >::H1(), PixH2SV1< T >::H1(), PixH2SV2< T >::H2(), PixH2SV1< T >::H2(), LFATAL, NO_INIT, PixH2SV2< T >::S(), PixH2SV1< T >::S(), src, PixH2SV2< T >::V(), and PixH2SV1< T >::V(). |
|
||||||||||||||||||||||||||||||||
|
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 709 of file ColorOps.C. References ASSERT, Image< T >::beginw(), GVX_TRACE, lum, NO_INIT, src, and lobot::stop(). |
|
||||||||||||||||||||||||
|
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> |
|
||||||||||||||||||||||||
|
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). |
|
||||||||||||||||||||||||
|
Get YIQ color components.
Definition at line 517 of file ColorOps.C. References ASSERT, Image< T >::beginw(), GVX_TRACE, iptr, NO_INIT, src, and lobot::stop(). Referenced by infoMeasure(). |
|
||||||||||||||||||||||||||||
|
distance between hue of image pixels and a given hue
|
|
||||||||||||||||||||
|
Compute color information measure based in infoFFT.
Definition at line 477 of file ColorOps.C. References ASSERT, countThresh(), dct(), decXY(), getYIQ(), GVX_TRACE, i, lowPass3(), NO_INIT, Image< T >::setVal(), src, and y. Referenced by InformationChannel::doInput(). |
|
||||||||||||
|
Add color speckle noise to array; faster version, draws 'num' dots.
|
|
||||||||||
|
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 421 of file ColorOps.C. |
|
||||||||||
|
Compute luminance of a color image.
Definition at line 401 of file ColorOps.C. References ASSERT, Image< T >::beginw(), Image< T >::endw(), GVX_TRACE, NO_INIT, src, and lobot::stop(). |
|
||||||||||||||||
|
Normalize my values by those in the lum image.
Definition at line 572 of file ColorOps.C. References ASSERT, Image< T >::beginw(), GVX_TRACE, NO_INIT, src, and lobot::stop(). |
|
||||||||||
|
Compute luminance in NTSC coordinates. This version performs the same function as rgb2gray() in matlab Definition at line 427 of file ColorOps.C. References ASSERT, Image< T >::beginw(), Image< T >::endw(), GVX_TRACE, NO_INIT, lobot::round(), src, and lobot::stop(). Referenced by GenericFrame::asGrayU8NTSCLayout(), and InferoTemporalHmax::attentionShift(). |
|
||||||||||||||||||||
|
Set the red, green and blue components from 3 monochromatic images.
Definition at line 61 of file ColorOps.C. References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::endw(), Image< T >::getDims(), GVX_TRACE, Image< T >::isSameSize(), NO_INIT, and lobot::stop(). Referenced by RGBConvolvePyrBuilder< T >::build2(), colGreyCombo(), SimulationViewerNerdCam::drawMegaCombo(), SimulationViewerStd::drawMegaCombo(), getImage(), getSalDispImg(), greyWorldNormalize(), main(), normalizeRGB(), rectifyRgb(), and submain(). |
|
||||||||||
|
Return the pixel-wise maximum of the r, g and b component.
Definition at line 908 of file ColorOps.C. References getComponents(), GVX_TRACE, and takeMax(). Referenced by main(). |
|
||||||||||||||||||||
|
Normalize values between nmin and nmax.
Definition at line 189 of file ColorOps.H. References ASSERT, e, getMinMaxC(), src, and lobot::stop(). Referenced by main(), and normC255(). |
|
||||||||||||||||||||
|
Normalize each component of the RGB image separately. Normalize the red component with min.red() and max.red() etc. Definition at line 893 of file ColorOps.C. References PixRGB< T >::blue(), getComponents(), PixRGB< T >::green(), GVX_TRACE, inplaceNormalize(), makeRGB(), and PixRGB< T >::red(). Referenced by ScaleSurpriseControl< FLOAT >::SSCgetDiffImage(), and ScaleSurpriseControl< FLOAT >::SSCgetSeperableParts(). |
|
||||||||||||||||
|
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 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
|
|
||||||||||||||||
|
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). |
|
||||||||||||||||||||||||||||
|
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
|
|
||||||||||||||||||||
|
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 |
|
||||||||||||||||||||
|
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 |
|
||||||||||||||||
|
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 856 of file ColorOps.C. References ASSERT, distance(), getComponents(), GVX_TRACE, and log10(). |
|
||||||||||||||||||||
|
convert RGB color values into C.I.E. coordinates
|
|
||||||||||||||||
|
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. |
|
||||||||||||||||||||||||
|
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. |
|
||||||||||
|
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 472 of file ColorOps.C. References src. |
|
||||||||||
|
Convert grayscale image to RGB.
Definition at line 455 of file ColorOps.C. References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::endw(), Image< T >::getDims(), GVX_TRACE, Image< T >::initialized(), NO_INIT, and lobot::stop(). |
1.4.4