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 .......: ltiSplitImage.h 00027 * authors ....: Pablo Alvarado, Stefan Syberichs, Thomas Rusert 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 19.04.99 00030 * revisions ..: $Id: ltiSplitImage.h,v 1.5 2006/02/07 19:42:03 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_SPLIT_IMAGE_H_ 00034 #define _LTI_SPLIT_IMAGE_H_ 00035 00036 #include "ltiFunctor.h" 00037 #include "ltiImage.h" 00038 00039 namespace lti { 00040 00041 /** 00042 * Parent for all classes that split image into differen color 00043 * spaces components (color channels). 00044 * 00045 * \#include "ltiSplitImage.h" 00046 * 00047 * Split color image into color-channels. 00048 * 00049 * @ingroup gColor 00050 */ 00051 class splitImage : public functor { 00052 public: 00053 /** 00054 * default constructor 00055 */ 00056 splitImage() 00057 : functor() {}; 00058 00059 /** 00060 * destructor 00061 */ 00062 virtual ~splitImage() {}; 00063 00064 /** 00065 * Copy operator 00066 */ 00067 splitImage& copy(const splitImage& other); 00068 00069 /** 00070 * Copy operator 00071 */ 00072 splitImage& operator=(const splitImage& other); 00073 00074 /** 00075 * on-copy operator for 32-bit "floating point" channels 00076 */ 00077 virtual bool apply(const image& img, 00078 channel& c1, 00079 channel& c2, 00080 channel& c3) const = 0; 00081 /** 00082 * on-copy operator for 8-bit channels 00083 */ 00084 virtual bool apply(const image& img, 00085 channel8& c1, 00086 channel8& c2, 00087 channel8& c3) const = 0; 00088 00089 /** 00090 * on-copy operator for 32-bit floating point values 00091 */ 00092 virtual bool apply(const rgbPixel& pixel, 00093 float& c1, 00094 float& c2, 00095 float& c3) const = 0; 00096 00097 /** 00098 * on-copy operator for 8-bit values 00099 */ 00100 virtual bool apply(const rgbPixel& pixel, 00101 ubyte& c1, 00102 ubyte& c2, 00103 ubyte& c3) const = 0; 00104 00105 /** 00106 * returns the name of this type 00107 */ 00108 virtual const char* getTypeName() const; 00109 00110 /** 00111 * Returns the first of the three channels into which the image is split. 00112 * If you need only one channel, this might be faster than calling apply(). 00113 * @param img the source image 00114 * @param c1 the extracted channel 00115 */ 00116 virtual bool getFirst(const image& img, channel& c1) const; 00117 00118 /** 00119 * Returns the first of the three channels into which the image is split. 00120 * If you need only one channel, this might be faster than calling apply(). 00121 * @param img the source image 00122 * @param c1 the extracted channel 00123 */ 00124 virtual bool getFirst(const image& img, channel8& c1) const; 00125 00126 /** 00127 * Returns the second of the three channels into which the image is split. 00128 * If you need only one channel, this might be faster than calling apply(). 00129 * @param img the source image 00130 * @param c2 the extracted channel 00131 */ 00132 virtual bool getSecond(const image& img, channel& c2) const; 00133 00134 /** 00135 * Returns the second of the three channels into which the image is split. 00136 * If you need only one channel, this might be faster than calling apply(). 00137 * @param img the source image 00138 * @param c2 the extracted channel 00139 */ 00140 virtual bool getSecond(const image& img, channel8& c2) const; 00141 00142 /** 00143 * Returns the third of the three channels into which the image is split. 00144 * If you need only one channel, this might be faster than calling apply(). 00145 * @param img the source image 00146 * @param c3 the extracted channel 00147 */ 00148 virtual bool getThird(const image& img, channel& c3) const; 00149 00150 /** 00151 * Returns the third of the three channels into which the image is split. 00152 * If you need only one channel, this might be faster than calling apply(). 00153 * @param img the source image 00154 * @param c3 the extracted channel 00155 */ 00156 virtual bool getThird(const image& img, channel8& c3) const; 00157 00158 protected: 00159 00160 /** 00161 * return the minimum of three integers 00162 */ 00163 virtual int maximum(const int a, const int b, const int c) const; 00164 00165 /** 00166 * return the maximum of three integers 00167 */ 00168 virtual int minimum(const int a, const int b, const int c) const; 00169 00170 }; 00171 00172 } // namespace lti 00173 #endif