latest version v1.9 - last update 10 Apr 2010 |
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 .......: ltiSplitImageTorgI.h 00027 * authors ....: Pablo Alvarado, Stefan Syberichs, Thomas Rusert 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 19.04.99 00030 * revisions ..: $Id: ltiSplitImageTorgI.h,v 1.4 2006/02/08 11:55:22 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_SPLIT_IMAGE_TO_RGI_H_ 00034 #define _LTI_SPLIT_IMAGE_TO_RGI_H_ 00035 00036 #include "ltiSplitImage.h" 00037 00038 namespace lti { 00039 00040 /** 00041 * Split image in its chromaticity channels. 00042 * 00043 * The chromaticity channels are defined as follows: 00044 * - intensity channel \f$ I = \frac{R+G+B}{3} \f$ 00045 * - chromacity red \f$ r = \frac{R}{R+G+B} \f$ 00046 * - chromacity green \f$ g = \frac{G}{R+G+B} \f$ 00047 * 00048 * You can get all channels at the same time using apply() or just 00049 * get one using the shortcut methods getR(), getG() or getIntensity(). 00050 * 00051 * @ingroup gColor 00052 */ 00053 class splitImageTorgI : public splitImage { 00054 public: 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 chromacity channels r and g and intensity 00067 * channel. 00068 * The values of each pixel will be between 0.0f and 1.0f 00069 * @param img the image to be splitted 00070 * @param r the chromacity channel 00071 * @param g the chromacity channel 00072 * @param I the intensity channel 00073 */ 00074 virtual bool apply(const image& img, 00075 channel& r, 00076 channel& g, 00077 channel& I) const; 00078 00079 /** 00080 * split the image in chromacity channels r and g and intensity 00081 * channel. 00082 * The values of each pixel will be between 0 and 255 00083 * @param img the image to be splitted 00084 * @param r the chromacity channel 00085 * @param g the chromacity channel 00086 * @param I the intensity channel 00087 */ 00088 virtual bool apply(const image& img, 00089 channel8& r, 00090 channel8& g, 00091 channel8& I) const; 00092 00093 /** 00094 * split the pixel in chromacity values r and g and intensity 00095 * value. 00096 * The values of each pixel will be between 0.0f and 1.0f 00097 * @param pixel the pixel to be splitted 00098 * @param r the chromacity value 00099 * @param g the chromacity value 00100 * @param I the intensity value 00101 */ 00102 virtual bool apply(const rgbPixel& pixel, 00103 float& r, 00104 float& g, 00105 float& I) const; 00106 00107 /** 00108 * split the pixel in chromacity values r and g and intensity 00109 * value. 00110 * The values of each pixel will be between 0 and 255 00111 * @param pixel the pixel to be splitted 00112 * @param r the chromacity value 00113 * @param g the chromacity value 00114 * @param I the intensity value 00115 */ 00116 virtual bool apply(const rgbPixel& pixel, 00117 ubyte& r, 00118 ubyte& g, 00119 ubyte& I) const; 00120 00121 /** shortcut to get the red channel only 00122 * The values of each pixel will be between 0.0f and 1.0f 00123 * @param img the image to be splitted 00124 * @param r the chromacity red channel 00125 */ 00126 bool getR(const image& img, 00127 channel& r) const; 00128 00129 00130 /** 00131 * shortcut to get the red channel only 00132 * The values of each pixel will be between 0 and 255 00133 * @param img the image to be splitted 00134 * @param r the chromacity red channel 00135 */ 00136 bool getR(const image& img, 00137 channel8& r) const; 00138 00139 /** 00140 * shortcut to get the red channel only 00141 * The values of each pixel will be between 0.0f and 1.0f 00142 * @param img the image to be splitted 00143 * @param g the chromacity green channel 00144 */ 00145 bool getG(const image& img, 00146 channel& g) const; 00147 00148 /** 00149 * shortcut to get the green channel only 00150 * The values of each pixel will be between 0 and 255 00151 * @param img the image to be splitted 00152 * @param g the chromacity green channel 00153 */ 00154 bool getG(const image& img, 00155 channel8& g) const; 00156 00157 /** 00158 * shortcut to get the red channel only 00159 * The values of each pixel will be between 0.0f and 1.0f 00160 * @param img the image to be splitted 00161 * @param I the intensity channel 00162 */ 00163 bool getIntensity(const image& img, 00164 channel& I) const; 00165 00166 00167 /** 00168 * shortcut to get the red channel only 00169 * The values of each pixel will be between 0 and 255 00170 * @param img the image to be splitted 00171 * @param I the intensity channel 00172 */ 00173 bool getIntensity(const image& img, 00174 channel8& I) const; 00175 00176 /** 00177 * Returns the first of the three channels into which the image is split. 00178 * If you need only one channel, this might be faster than calling apply(). 00179 * @param img the source image 00180 * @param c1 the extracted channel 00181 */ 00182 virtual bool getFirst(const image& img, channel& c1) const; 00183 00184 /** 00185 * Returns the first of the three channels into which the image is split. 00186 * If you need only one channel, this might be faster than calling apply(). 00187 * @param img the source image 00188 * @param c1 the extracted channel 00189 */ 00190 virtual bool getFirst(const image& img, channel8& c1) const; 00191 00192 /** 00193 * Returns the second of the three channels into which the image is split. 00194 * If you need only one channel, this might be faster than calling apply(). 00195 * @param img the source image 00196 * @param c2 the extracted channel 00197 */ 00198 virtual bool getSecond(const image& img, channel& c2) const; 00199 00200 /** 00201 * Returns the second of the three channels into which the image is split. 00202 * If you need only one channel, this might be faster than calling apply(). 00203 * @param img the source image 00204 * @param c2 the extracted channel 00205 */ 00206 virtual bool getSecond(const image& img, channel8& c2) const; 00207 00208 /** 00209 * Returns the third of the three channels into which the image is split. 00210 * If you need only one channel, this might be faster than calling apply(). 00211 * @param img the source image 00212 * @param c3 the extracted channel 00213 */ 00214 virtual bool getThird(const image& img, channel& c3) const; 00215 00216 /** 00217 * Returns the third of the three channels into which the image is split. 00218 * If you need only one channel, this might be faster than calling apply(). 00219 * @param img the source image 00220 * @param c3 the extracted channel 00221 */ 00222 virtual bool getThird(const image& img, channel8& c3) const; 00223 00224 }; 00225 00226 } // namespace lti 00227 #endif