CVR-Lib last update 20 Sep 2009

cvr::mergeHSIToImage Class Reference
[Color Analysis]

Merge HSI (Hue Saturation Intensity) channels. More...

#include <cvrMergeHSIToImage.h>

Inheritance diagram for cvr::mergeHSIToImage:

Inheritance graph
[legend]
Collaboration diagram for cvr::mergeHSIToImage:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 mergeHSIToImage (void)
virtual const std::string & name () const
virtual mergeHSIToImageclone () const
virtual mergeHSIToImagenewInstance () const
virtual bool apply (const matrix< float > &H, const matrix< float > &S, const matrix< float > &I, image &img) const
virtual bool apply (const matrix< ubyte > &H, const matrix< ubyte > &S, const matrix< ubyte > &I, image &img) const
virtual bool apply (const float &H, const float &S, const float &I, rgbaPixel &pixel) const
virtual bool apply (const ubyte &H, const ubyte &S, const ubyte &I, rgbaPixel &pixel) const


Detailed Description

Merge HSI (Hue Saturation Intensity) channels.

It is assumed that all channels have "valid" values, i.e., if the inputs are of type cvr::channel, the Hue has values between 0.0 and 1.0 (meaning 0 to 360 degrees), Saturation and Intensity between 0.0 and 1.0. For cvr::channel8, the possible value ranges are always valid.

If any component is not valid, then unpredictible results have to be expected, including segmentation faults, as the computations use some LUT to improve speed.

The transformation from HSI to RGB depends on the value range of hue (H). It first computes chromaticity values r,g,b:

If $0^\circ \leq H < 120^\circ$

\[ \begin{aligned} r &= \frac{1}{3}\left[1+\frac{S \cos(H)}{\cos(60^\circ-H)}\right] \\ g &= 1-(r+b) \\ b &= \frac{1}{3}(1-S) \end{aligned} \]

If $120^\circ \leq H < 240^\circ$

\[ \begin{aligned} r &= \frac{1}{3}(1-S) \\ g &= \frac{1}{3}\left[1+\frac{S \cos(H-120^\circ)} {\cos(180^\circ-H)}\right] \\ b &= 1-(r+g) \end{aligned} \]

If $240^\circ \leq H < 360^\circ$

\[ \begin{aligned} g &= \frac{1}{3}(1-S) \\ b &= \frac{1}{3}\left[1+\frac{S \cos(H-240^\circ)} {\cos(300^\circ-H)}\right] \\ r &= 1-(g+b) \end{aligned} \]

With these chromaticity values, the RGB tuple can easily be computed as

\[ \begin{aligned} R &= 3rI \\ G &= 3gI \\ B &= 3bI \\ \end{aligned} \]

See also:
cvr::splitImageToHSI

Constructor & Destructor Documentation

cvr::mergeHSIToImage::mergeHSIToImage ( void   ) 

Constructor.


Member Function Documentation

virtual bool cvr::mergeHSIToImage::apply ( const ubyte H,
const ubyte S,
const ubyte I,
rgbaPixel pixel 
) const [virtual]

merge the hue value H, saturation S and intensity value I to a pixel

Parameters:
H the hue value
S the saturation value
I the intensity value
pixel the merged pixel

Implements cvr::mergeImage.

virtual bool cvr::mergeHSIToImage::apply ( const float &  H,
const float &  S,
const float &  I,
rgbaPixel pixel 
) const [virtual]

merge the hue value H, saturation S and intensity value I to a pixel

Parameters:
H the hue value
S the saturation value
I the intensity value
pixel the merged pixel

Implements cvr::mergeImage.

virtual bool cvr::mergeHSIToImage::apply ( const matrix< ubyte > &  H,
const matrix< ubyte > &  S,
const matrix< ubyte > &  I,
image img 
) const [virtual]

merge hue channel H, saturation S and intensity channel I to an image

Parameters:
H the hue channel
S the saturation channel
I the intensity channel
img the image to be splitted

Implements cvr::mergeImage.

virtual bool cvr::mergeHSIToImage::apply ( const matrix< float > &  H,
const matrix< float > &  S,
const matrix< float > &  I,
image img 
) const [virtual]

merge hue channel H, saturation S and intensity channel I to an image

Parameters:
H the hue channel
S the saturation channel
I the intensity channel
img the image to be splitted

Implements cvr::mergeImage.

virtual mergeHSIToImage* cvr::mergeHSIToImage::clone (  )  const [virtual]

returns a pointer to a clone of the functor.

Implements cvr::mergeImage.

virtual const std::string& cvr::mergeHSIToImage::name (  )  const [virtual]

return the name of this type

Implements cvr::functor.

virtual mergeHSIToImage* cvr::mergeHSIToImage::newInstance (  )  const [virtual]

returns a pointer to a new instance of the functor.

Implements cvr::mergeImage.


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

Generated on Sun Sep 20 22:08:50 2009 for CVR-Lib by Doxygen 1.5.8