IVT
Color Processing

Classes

class  CRGBColorModel
 Training and application of an RGB color model on the basis of the Mahalanobis distance. More...

Functions

bool ImageProcessor::FilterRGB (const CByteImage *pInputImage, CByteImage *pOutputImage, CRGBColorModel *pColorModel, float fThreshold)
 Performs color filtering with binarization for an RGB CByteImage, given a CRGBColorModel, and writes the result to a grayscale CByteImage.
bool ImageProcessor::CalculateHSVImage (const CByteImage *pInputImage, CByteImage *pOutputImage, const MyRegion *pROI=0)
 Computes the HSV image for a RGB CByteImage and writes the result to a CByteImage.
bool ImageProcessor::FilterHSV (const CByteImage *pInputImage, CByteImage *pOutputImage, unsigned char hue, unsigned char tol_hue, unsigned char min_sat, unsigned char max_sat, unsigned char min_v, unsigned char max_v, const MyRegion *pROI=0)
 Performs color filtering with binarization for an HSV CByteImage and writes the result to a grayscale CByteImage.
bool ImageProcessor::FilterHSV2 (const CByteImage *pInputImage, CByteImage *pOutputImage, unsigned char min_hue, unsigned char max_hue, unsigned char min_sat, unsigned char max_sat, unsigned char min_v, unsigned char max_v, const MyRegion *pROI=0)
 Performs color filtering with binarization for an HSV CByteImage and writes the result to a grayscale CByteImage.

Function Documentation

bool ImageProcessor::CalculateHSVImage ( const CByteImage pInputImage,
CByteImage pOutputImage,
const MyRegion pROI = 0 
)

Computes the HSV image for a RGB CByteImage and writes the result to a CByteImage.

Converts each pInputImage from RGB24 to HSV24 (Hue, Saturation, Value) and writes the result pOutputImage.

The width and height of pInputImage and pOutputImage must match.
pInputImage and pOutputImage must be both of type CByteImage::eRGB24.

The pixels of pOutputImage are after completion encoded according to the HSV color model, although the type of the image is CByteImage::eRGB24. The values S (Saturation) and V (Value) have a possible range of [0, 255]. The value H (Hue) has a possible range of [0, 179].

As this is a point operation, there is no copy overhead if pInputImage and pOutputImage share the same memory area.

Parameters:
pInputImageThe input image.
pOutputImageThe output image.
pROIDescribes the area containing the pixels which shall be converted. If pROI is 0, then the whole image is processed.

Definition at line 4491 of file ImageProcessor.cpp.

bool ImageProcessor::FilterHSV ( const CByteImage pInputImage,
CByteImage pOutputImage,
unsigned char  hue,
unsigned char  tol_hue,
unsigned char  min_sat,
unsigned char  max_sat,
unsigned char  min_v,
unsigned char  max_v,
const MyRegion pROI = 0 
)

Performs color filtering with binarization for an HSV CByteImage and writes the result to a grayscale CByteImage.

The color segmentation is performed using fixed bounds (with the operator <= and >=) for each color channel, except of hue where a center value and a +- tolerance are specified.

The width and height of pInputImage and pOutputImage must match.

Parameters:
pInputImageThe input image. Must be of type CByteImage::eRGB24 and is assumed to be an HSV image (see also CalculateHSVImage(const CByteImage*, CByteImage*, const *pROI)).
pOutputImageThe output image. Must be of type CByteImage::eGrayScale.
hueThe hue center.
tol_hueThe hue tolerance.
min_satThe minimum saturation.
max_satThe maximum saturation.
min_vThe minimum value.
max_vThe maximum value.
pROIDescribes the area containing the pixels which shall be processed. If pROI is 0, then the whole image is processed.

Definition at line 3983 of file ImageProcessor.cpp.

bool ImageProcessor::FilterHSV2 ( const CByteImage pInputImage,
CByteImage pOutputImage,
unsigned char  min_hue,
unsigned char  max_hue,
unsigned char  min_sat,
unsigned char  max_sat,
unsigned char  min_v,
unsigned char  max_v,
const MyRegion pROI = 0 
)

Performs color filtering with binarization for an HSV CByteImage and writes the result to a grayscale CByteImage.

The color segmentation is performed using fixed bounds (with the operator <= and >=) for each color channel.

The width and height of pInputImage and pOutputImage must match.

Parameters:
pInputImageThe input image. Must be of type CByteImage::eRGB24 and is assumed to be a HSV image (see also CalculateHSVImage(const CByteImage*, CByteImage*, const *pROI)).
pOutputImageThe output image. Must be of type CByteImage::eGrayScale.
min_hueThe minimum hue.
max_hueThe maximum hue.
min_satThe minimum saturation.
max_satThe maximum saturation.
min_vThe minimum value.
max_vThe maximum value.
pROIDescribes the area containing the pixels which shall be processed. If pROI is 0, then the whole image is processed.

Definition at line 4010 of file ImageProcessor.cpp.

bool ImageProcessor::FilterRGB ( const CByteImage pInputImage,
CByteImage pOutputImage,
CRGBColorModel pColorModel,
float  fThreshold 
)

Performs color filtering with binarization for an RGB CByteImage, given a CRGBColorModel, and writes the result to a grayscale CByteImage.

Calculates the color probability of each pixel in pInputImage based on the Mahalanobis distance and write the result to pOutputImage.

Using the covariance matrix C the Mahalanobis distance is calculated by $ f_{+}(x) = exp(-\frac{1}{2}(x - \bar x)^T C^{-1} (x - \bar x)) $. pOutputImage is a binary image.

The width and height of pInputImage and pOutputImage must match.

Parameters:
pInputImageThe input image. Must be of type CByteImage::eRGB24.
pOutputImageThe output image. Must be of type CByteImage::eGrayScale.
pColorModelThe color model.
fThresholdThe threshold value. All color probabilities > fThreshold are set to 255, all other to 0.

Definition at line 3960 of file ImageProcessor.cpp.