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

ltiSplitImageToGSC.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 .......: ltiSplitImageToGSC.h
00027  * authors ....: Pablo Alvarado, Stefan Syberichs, Thomas Rusert
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 19.04.99
00030  * revisions ..: $Id: ltiSplitImageToGSC.h,v 1.4 2006/02/08 11:52:33 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_SPLIT_IMAGE_TO_GSC_H_
00034 #define _LTI_SPLIT_IMAGE_TO_GSC_H_
00035 
00036 #include "ltiSplitImage.h"
00037 #include "ltiArctanLUT.h"
00038 
00039 namespace lti {
00040 
00041   /**
00042    * Split image in its c1, c2 and c3 components, as described in 
00043    * T. Gevers and A. Smeulders "Color-based object recognition"
00044    * Pattern Recognition, Vol. 32, 1999, pp. 453-464.
00045    *
00046    * This color space is appropriate when trying to detect only highlight or
00047    * material changes, but ignoring shadow or shape edges.
00048    *
00049    * The channels are defined as follows:
00050    * \f[
00051    * \begin{aligned}
00052    * c_1 &= \arctan \left( \frac{R}{\max(G,B)} \right) \cdot \frac{2}{\pi}\\
00053    * c_2 &= \arctan \left( \frac{G}{\max(R,B)} \right) \cdot \frac{2}{\pi}\\
00054    * c_3 &= \arctan \left( \frac{B}{\max(R,G)} \right) \cdot \frac{2}{\pi}
00055    * \end{aligned}
00056    * \f]
00057    *
00058    * They denote the angles of the body reflection vector and are invariant for
00059    * matte, dull objects.
00060    *
00061    * Please note the slightly difference with the original paper definition:
00062    * all channels are normalized in order to get values between 0 and 1.
00063    *
00064    * There is no merge functor for this split method.
00065    *
00066    * @ingroup gColor
00067    */
00068   class splitImageToGSC : public splitImage {
00069   public:
00070     /**
00071      * returns the name of this type
00072      */
00073     virtual const char* getTypeName() const;
00074 
00075     /**
00076      * returns a pointer to a clone of the functor.
00077      */
00078     virtual functor* clone() const;
00079 
00080     /**
00081      * split the image in red green and blue channels.
00082      * The values of each pixel will be between 0.0f and 1.0f
00083      * @param img the image to be splitted
00084      * @param c1 first channel
00085      * @param c2 second channel
00086      * @param c3 third channel
00087      */
00088     virtual bool apply(const image& img,
00089                        channel& c1,
00090                        channel& c2,
00091                        channel& c3) const;
00092 
00093     /**
00094      * split the image in red green and blue channels.  The values of
00095      * each pixel will be between 0 and 255
00096      * @param img the image to be splitted
00097      * @param c1 first channel
00098      * @param c2 second channel
00099      * @param c3 third channel
00100      */
00101     virtual bool apply(const image& img,
00102                        channel8& c1,
00103                        channel8& c2,
00104                        channel8& c3) const;
00105 
00106     /**
00107      * split the pixel in red green and blue values.
00108      * The values of each pixel will be between 0.0f and 1.0f
00109      * @param pixel the pixel to be splitted
00110      * @param c1 first channel
00111      * @param c2 second channel
00112      * @param c3 third channel
00113      */
00114     virtual bool apply(const rgbPixel& pixel,
00115            float& c1,
00116            float& c2,
00117            float& c3) const;
00118 
00119     /**
00120      * split the pixel in red green and blue values.  The values of
00121      * each pixel will be between 0 and 255
00122      * @param pixel the pixel to be splitted
00123      * @param c1 first channel
00124      * @param c2 second channel
00125      * @param c3 third channel
00126      */
00127     virtual bool apply(const rgbPixel& pixel,
00128            ubyte& c1,
00129            ubyte& c2,
00130            ubyte& c3) const;
00131 
00132     /**
00133      * Returns the first of the three channels into which the image is split.
00134      * If you need only one channel, this might be faster than calling apply().
00135      * @param img the source image
00136      * @param c1 the extracted channel
00137      */
00138     virtual bool getFirst(const image& img, channel& c1) const;
00139 
00140     /**
00141      * Returns the first of the three channels into which the image is split.
00142      * If you need only one channel, this might be faster than calling apply().
00143      * @param img the source image
00144      * @param c1 the extracted channel
00145      */
00146     virtual bool getFirst(const image& img, channel8& c1) const;
00147 
00148     /**
00149      * Returns the second of the three channels into which the image is split.
00150      * If you need only one channel, this might be faster than calling apply().
00151      * @param img the source image
00152      * @param c2 the extracted channel
00153      */
00154     virtual bool getSecond(const image& img, channel& c2) const;
00155 
00156     /**
00157      * Returns the second of the three channels into which the image is split.
00158      * If you need only one channel, this might be faster than calling apply().
00159      * @param img the source image
00160      * @param c2 the extracted channel
00161      */
00162     virtual bool getSecond(const image& img, channel8& c2) const;
00163 
00164     /**
00165      * Returns the third of the three channels into which the image is split.
00166      * If you need only one channel, this might be faster than calling apply().
00167      * @param img the source image
00168      * @param c3 the extracted channel
00169      */
00170     virtual bool getThird(const image& img, channel& c3) const;
00171 
00172     /**
00173      * Returns the third of the three channels into which the image is split.
00174      * If you need only one channel, this might be faster than calling apply().
00175      * @param img the source image
00176      * @param c3 the extracted channel
00177      */
00178     virtual bool getThird(const image& img, channel8& c3) const;
00179 
00180   protected:
00181     /**
00182      * arctan LUT
00183      */
00184     arctanLUT atan2;
00185   };
00186 
00187 } // namespace lti
00188 #endif

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