LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiSplitImageToHSI.h

00001 /*
00002  * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
00003  * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany
00004  *
00005  * This file is part of the LTI-Computer Vision Library (LTI-Lib)
00006  *
00007  * The LTI-Lib is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License (LGPL)
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * The LTI-Lib is distributed in the hope that it will be
00013  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00014  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with the LTI-Lib; see the file LICENSE.  If
00019  * not, write to the Free Software Foundation, Inc., 59 Temple Place -
00020  * Suite 330, Boston, MA 02111-1307, USA.
00021  */
00022 
00023 
00024 /*----------------------------------------------------------------
00025  * project ....: LTI Digital Image/Signal Processing Library
00026  * file .......: ltiSplitImageToHSI.h
00027  * authors ....: Pablo Alvarado, Stefan Syberichs, Thomas Rusert
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 19.04.99
00030  * revisions ..: $Id: ltiSplitImageToHSI.h,v 1.4 2006/02/08 11:53:24 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_SPLIT_IMAGE_TO_HSI_H_
00034 #define _LTI_SPLIT_IMAGE_TO_HSI_H_
00035 
00036 #include "ltiSplitImage.h"
00037 
00038 namespace lti {
00039 
00040   // declared somewhere else...
00041   template<class T> class triMatrix;
00042 
00043   /**
00044    * Split image in its Hue - Saturation - Intensity channels
00045    *
00046    * @ingroup gColor
00047    */
00048   class splitImageToHSI : public splitImage {
00049   public:
00050     /**
00051      * Constructor
00052      */
00053     splitImageToHSI(void);
00054 
00055     /**
00056      * returns the name of this type
00057      */
00058     virtual const char* getTypeName() const;
00059 
00060     /**
00061      * returns a pointer to a clone of the functor.
00062      */
00063     virtual functor* clone() const;
00064 
00065     /**
00066      * split the image in hue channel H, saturation S and intensity
00067      * channel I.
00068      * The values of each image will be between 0.0f and 1.0f
00069      * @param img the image to be splitted
00070      * @param H the hue channel
00071      * @param S the saturation channel
00072      * @param I the intensity channel
00073      */
00074     virtual bool apply(const image& img,
00075                        channel& H,
00076                        channel& S,
00077                        channel& I) const;
00078 
00079     /**
00080      * split the image in hue channel H, saturation S and intensity
00081      * channel I.
00082      * The values of each image will be between 0 and 255
00083      * @param img the image to be splitted
00084      * @param H the hue channel
00085      * @param S the saturation channel
00086      * @param I the intensity channel
00087      */
00088     virtual bool apply(const image& img,
00089                        channel8& H,
00090                        channel8& S,
00091                        channel8& I) const;
00092 
00093     /**
00094      * split the pixel in hue value H, saturation S and intensity
00095      * value I.
00096      * The values of each pixel will be between 0.0f and 1.0f
00097      * @param pixel the pixel to be splitted
00098      * @param H the hue value
00099      * @param S the saturation value
00100      * @param I the intensity value
00101      */
00102     virtual bool apply(const rgbPixel& pixel,
00103                        float& H,
00104                        float& S,
00105                        float& I) const;
00106 
00107     /**
00108      * split the pixel in hue value H, saturation S and intensity
00109      * value I.
00110      * The values of each pixel will be between 0 and 255
00111      * @param pixel the pixel to be splitted
00112      * @param H the hue value
00113      * @param S the saturation value
00114      * @param I the intensity value
00115      */
00116     virtual bool apply(const rgbPixel& pixel,
00117                        ubyte& H,
00118                        ubyte& S,
00119                        ubyte& I) const;
00120 
00121     /**
00122      * return the hue of the image.  If you need also the saturation and
00123      * the intensity please use the apply methods, which are much faster!
00124      */
00125     bool getHue(const image& img, channel& hue) const;
00126 
00127     /**
00128      * return the hue of the image.  If you need also the saturation and
00129      * the intensity please use the apply methods, which are much faster!
00130      */
00131     bool getHue(const image& img, channel8& hue) const;
00132 
00133     /**
00134      * return the saturation of the image.  If you need also the hue and
00135      * the intensity please use the apply methods, which are much faster!
00136      */
00137     bool getSaturation(const image& img, channel& saturation) const;
00138 
00139     /**
00140      * return the saturation of the image.  If you need also the hue and
00141      * the saturation please use the apply methods, which are much faster!
00142      */
00143     bool getSaturation(const image& img, channel8& saturation) const;
00144 
00145     /**
00146      * return the intensity of the image.  If you need also the hue and
00147      * the intensity please use the apply methods, which are much faster!
00148      */
00149     bool getIntensity(const image& img, channel& intensity) const;
00150 
00151     /**
00152      * return the intensity of the image.  If you need also the hue and
00153      * the intensity please use the apply methods, which are much faster!
00154      */
00155     bool getIntensity(const image& img, channel8& intensity) const;
00156 
00157 
00158     /**
00159      * Returns the first of the three channels into which the image is split.
00160      * If you need only one channel, this might be faster than calling apply().
00161      * @param img the source image
00162      * @param c1 the extracted channel
00163      */
00164     virtual bool getFirst(const image& img, channel& c1) const;
00165 
00166     /**
00167      * Returns the first of the three channels into which the image is split.
00168      * If you need only one channel, this might be faster than calling apply().
00169      * @param img the source image
00170      * @param c1 the extracted channel
00171      */
00172     virtual bool getFirst(const image& img, channel8& c1) const;
00173 
00174     /**
00175      * Returns the second of the three channels into which the image is split.
00176      * If you need only one channel, this might be faster than calling apply().
00177      * @param img the source image
00178      * @param c2 the extracted channel
00179      */
00180     virtual bool getSecond(const image& img, channel& c2) const;
00181 
00182     /**
00183      * Returns the second of the three channels into which the image is split.
00184      * If you need only one channel, this might be faster than calling apply().
00185      * @param img the source image
00186      * @param c2 the extracted channel
00187      */
00188     virtual bool getSecond(const image& img, channel8& c2) const;
00189 
00190     /**
00191      * Returns the third of the three channels into which the image is split.
00192      * If you need only one channel, this might be faster than calling apply().
00193      * @param img the source image
00194      * @param c3 the extracted channel
00195      */
00196     virtual bool getThird(const image& img, channel& c3) const;
00197 
00198     /**
00199      * Returns the third of the three channels into which the image is split.
00200      * If you need only one channel, this might be faster than calling apply().
00201      * @param img the source image
00202      * @param c3 the extracted channel
00203      */
00204     virtual bool getThird(const image& img, channel8& c3) const;
00205 
00206   private:
00207     /**
00208      * Triangular matrix for RGB-HSI-Conversion
00209      */
00210     static triMatrix<int>* HueHSI;
00211 
00212     /**
00213      * HueHSI initialized?
00214      * The conversion matrix (LUT) needs to be initialized only once!
00215      */
00216     static bool hueInitialized;
00217   };
00218 
00219 } // namespace lti
00220 #endif

Generated on Sat Apr 10 15:26:14 2010 for LTI-Lib by Doxygen 1.6.1