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 .......: ltiSplitImageToRGB.h 00027 * authors ....: Pablo Alvarado, Stefan Syberichs, Thomas Rusert 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 19.04.99 00030 * revisions ..: $Id: ltiSplitImageToRGB.h,v 1.4 2006/02/08 11:54:13 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_SPLIT_IMAGE_RGB_H_ 00034 #define _LTI_SPLIT_IMAGE_RGB_H_ 00035 00036 #include "ltiSplitImage.h" 00037 00038 namespace lti { 00039 00040 /** 00041 * Split image in its Red - Green - Blue channels. 00042 * You can split all the channels at the same time (with apply) or 00043 * get just one channel using the shortcut functions getRed(), getGreen() 00044 * or getBlue(). 00045 * @see lti::mergeRGBToImage 00046 * 00047 * @ingroup gColor 00048 */ 00049 class splitImageToRGB : public splitImage { 00050 public: 00051 /** 00052 * returns the name of this type 00053 */ 00054 virtual const char* getTypeName() const; 00055 00056 /** 00057 * returns a pointer to a clone of the functor. 00058 */ 00059 virtual functor* clone() const; 00060 00061 /** 00062 * Split the image in red green and blue channels. 00063 * The values of each pixel will be between 0.0f and 1.0f 00064 * @param img the image to be splitted 00065 * @param red the red channel 00066 * @param green the green channel 00067 * @param blue the blue channel 00068 * @return true if successful, false otherwise. 00069 */ 00070 virtual bool apply(const image& img, 00071 channel& red, 00072 channel& green, 00073 channel& blue) const; 00074 00075 /** 00076 * split the image in red green and blue channels. 00077 * The values of each pixel will be between 0.0f and 1.0f 00078 * @param img the image to be splitted 00079 * @param red the red channel 00080 * @param green the green channel 00081 * @param blue the blue channel 00082 * @param alpha or dummy channel 00083 * @return true if successful, false otherwise. 00084 */ 00085 virtual bool apply(const image& img, 00086 channel& red, 00087 channel& green, 00088 channel& blue, 00089 channel& alpha) const; 00090 00091 /** 00092 * split the image in red green and blue channels. The values of 00093 * each pixel will be between 0 and 255 00094 * @param img the image to be splitted 00095 * @param red the red channel 00096 * @param green the green channel 00097 * @param blue the blue channel 00098 * @return true if successful, false otherwise. 00099 */ 00100 virtual bool apply(const image& img, 00101 channel8& red, 00102 channel8& green, 00103 channel8& blue) const; 00104 00105 /** 00106 * split the image in red green and blue channels. The values of 00107 * each pixel will be between 0 and 255 00108 * @param img the image to be splitted 00109 * @param red the red channel 00110 * @param green the green channel 00111 * @param blue the blue channel 00112 * @param alpha or dummy channel 00113 * @return true if successful, false otherwise. 00114 */ 00115 virtual bool apply(const image& img, 00116 channel8& red, 00117 channel8& green, 00118 channel8& blue, 00119 channel8& alpha) const; 00120 00121 /** 00122 * split the pixel in red green and blue values. 00123 * The values of each pixel will be between 0.0f and 1.0f 00124 * @param pixel the pixel to be splitted 00125 * @param red the red value 00126 * @param green the green value 00127 * @param blue the blue value 00128 * @return true if successful, false otherwise. 00129 */ 00130 virtual bool apply(const rgbPixel& pixel, 00131 float& red, 00132 float& green, 00133 float& blue) const; 00134 00135 /** 00136 * split the pixel in red green and blue values. The values of 00137 * each pixel will be between 0 and 255 00138 * @param pixel the pixel to be splitted 00139 * @param red the red value 00140 * @param green the green value 00141 * @param blue the blue value 00142 */ 00143 virtual bool apply(const rgbPixel& pixel, 00144 ubyte& red, 00145 ubyte& green, 00146 ubyte& blue) const; 00147 00148 /** 00149 * shortcut to get the red channel only 00150 * The values of each pixel will be between 0.0f and 1.0f 00151 * @param img the image to be splitted 00152 * @param red the red channel 00153 */ 00154 bool getRed(const image& img, 00155 channel& red) const; 00156 00157 00158 /** 00159 * shortcut to get the red channel only 00160 * The values of each pixel will be between 0 and 255 00161 * @param img the image to be splitted 00162 * @param red the red channel 00163 */ 00164 bool getRed(const image& img, 00165 channel8& red) const; 00166 00167 /** 00168 * shortcut to get the red channel only 00169 * The values of each pixel will be between 0.0f and 1.0f 00170 * @param img the image to be splitted 00171 * @param green the green channel 00172 */ 00173 bool getGreen(const image& img, 00174 channel& green) const; 00175 00176 00177 /** 00178 * shortcut to get the green channel only 00179 * The values of each pixel will be between 0 and 255 00180 * @param img the image to be splitted 00181 * @param green the green channel 00182 */ 00183 bool getGreen(const image& img, 00184 channel8& green) const; 00185 00186 /** 00187 * shortcut to get the red channel only 00188 * The values of each pixel will be between 0.0f and 1.0f 00189 * @param img the image to be splitted 00190 * @param blue the blue channel 00191 */ 00192 bool getBlue(const image& img, 00193 channel& blue) const; 00194 00195 00196 /** 00197 * shortcut to get the red channel only 00198 * The values of each pixel will be between 0 and 255 00199 * @param img the image to be splitted 00200 * @param blue the blue channel 00201 */ 00202 bool getBlue(const image& img, 00203 channel8& blue) const; 00204 00205 /** 00206 * Returns the first of the three channels into which the image is split. 00207 * If you need only one channel, this might be faster than calling apply(). 00208 * @param img the source image 00209 * @param c1 the extracted channel 00210 */ 00211 virtual bool getFirst(const image& img, channel& c1) const; 00212 00213 /** 00214 * Returns the first of the three channels into which the image is split. 00215 * If you need only one channel, this might be faster than calling apply(). 00216 * @param img the source image 00217 * @param c1 the extracted channel 00218 */ 00219 virtual bool getFirst(const image& img, channel8& c1) const; 00220 00221 /** 00222 * Returns the second of the three channels into which the image is split. 00223 * If you need only one channel, this might be faster than calling apply(). 00224 * @param img the source image 00225 * @param c2 the extracted channel 00226 */ 00227 virtual bool getSecond(const image& img, channel& c2) const; 00228 00229 /** 00230 * Returns the second of the three channels into which the image is split. 00231 * If you need only one channel, this might be faster than calling apply(). 00232 * @param img the source image 00233 * @param c2 the extracted channel 00234 */ 00235 virtual bool getSecond(const image& img, channel8& c2) const; 00236 00237 /** 00238 * Returns the third of the three channels into which the image is split. 00239 * If you need only one channel, this might be faster than calling apply(). 00240 * @param img the source image 00241 * @param c3 the extracted channel 00242 */ 00243 virtual bool getThird(const image& img, channel& c3) const; 00244 00245 /** 00246 * Returns the third of the three channels into which the image is split. 00247 * If you need only one channel, this might be faster than calling apply(). 00248 * @param img the source image 00249 * @param c3 the extracted channel 00250 */ 00251 virtual bool getThird(const image& img, channel8& c3) const; 00252 00253 }; 00254 00255 } // namespace lti 00256 #endif