00001 /*!@file Image/LowPass.H low-pass filtering and smoothing functions */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00005 // by the University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: Rob Peters <rjpeters at usc dot edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Image/LowPass.H $ 00035 // $Id: LowPass.H 8633 2007-07-26 00:00:28Z rjpeters $ 00036 // 00037 00038 #ifndef IMAGE_LOWPASS_H_DEFINED 00039 #define IMAGE_LOWPASS_H_DEFINED 00040 00041 #include "Util/Promotions.H" 00042 00043 class Dims; 00044 template <class T> class Image; 00045 00046 //! Low-pass filter, coeff * [0.25 0.5 0.25], applied separably in X and Y 00047 template <class T_or_RGB> 00048 Image<typename promote_trait<T_or_RGB, float>::TP> 00049 lowPass3(const Image<T_or_RGB>& src, 00050 const bool go_x = true, const bool go_y = true); 00051 00052 //! Low-pass filter, coeff * [0.25 0.5 0.25], applied in X 00053 template <class T_or_RGB> 00054 Image<typename promote_trait<T_or_RGB, float>::TP> 00055 lowPass3x(const Image<T_or_RGB>& src); 00056 00057 //! Low-pass filter, coeff * [0.25 0.5 0.25], applied in Y 00058 template <class T_or_RGB> 00059 Image<typename promote_trait<T_or_RGB, float>::TP> 00060 lowPass3y(const Image<T_or_RGB>& src); 00061 00062 //! Low-pass filter, Anderson's 5x5 separable 00063 template <class T_or_RGB> 00064 Image<typename promote_trait<T_or_RGB, float>::TP> 00065 lowPass5(const Image<T_or_RGB>& src, 00066 const bool go_x = true, const bool go_y = true); 00067 00068 //! Low-pass filter, Anderson's 5x5 separable, applied in X 00069 template <class T_or_RGB> 00070 Image<typename promote_trait<T_or_RGB, float>::TP> 00071 lowPass5x(const Image<T_or_RGB>& src); 00072 00073 //! Low-pass filter, Anderson's 5x5 separable, applied in Y 00074 template <class T_or_RGB> 00075 Image<typename promote_trait<T_or_RGB, float>::TP> 00076 lowPass5y(const Image<T_or_RGB>& src); 00077 00078 //! Low-pass filter, Anderson's 5x5 separable, applied in X, and X decimated by factor 00079 template <class T_or_RGB> 00080 Image<typename promote_trait<T_or_RGB, float>::TP> 00081 lowPass5xDecX(const Image<T_or_RGB>& src, const int factor = 2); 00082 00083 //! Low-pass filter, Anderson's 5x5 separable, applied in Y, and Y decimated by factor 00084 template <class T_or_RGB> 00085 Image<typename promote_trait<T_or_RGB, float>::TP> 00086 lowPass5yDecY(const Image<T_or_RGB>& src, const int factor = 2); 00087 00088 //! Low-pass filter, 9x9 separable 00089 template <class T_or_RGB> 00090 Image<typename promote_trait<T_or_RGB, float>::TP> 00091 lowPass9(const Image<T_or_RGB>& src, 00092 const bool go_x = true, const bool go_y = true); 00093 00094 //! Low-pass filter, 9x9 separable, applied in X 00095 template <class T_or_RGB> 00096 Image<typename promote_trait<T_or_RGB, float>::TP> 00097 lowPass9x(const Image<T_or_RGB>& src); 00098 00099 //! Low-pass filter, 9x9 separable, applied in Y 00100 template <class T_or_RGB> 00101 Image<typename promote_trait<T_or_RGB, float>::TP> 00102 lowPass9y(const Image<T_or_RGB>& src); 00103 00104 //! Low-pass filter, NxN separable 00105 /*! Just forwards to lowPass3/lowPass5/lowPass9, but allows the filter 00106 width to be selected at runtime. */ 00107 template <class T_or_RGB> 00108 Image<typename promote_trait<T_or_RGB, float>::TP> 00109 lowPass(const int N, const Image<T_or_RGB>& src, 00110 const bool go_x = true, const bool go_y = true); 00111 00112 //! Low-pass filter, NxN separable, applied in X 00113 /*! Just forwards to lowPass3x/lowPass5x/lowPass9x, but allows the filter 00114 width to be selected at runtime. */ 00115 template <class T_or_RGB> 00116 Image<typename promote_trait<T_or_RGB, float>::TP> 00117 lowPassX(const int N, const Image<T_or_RGB>& src); 00118 00119 //! Low-pass filter, NxN separable, applied in Y 00120 /*! Just forwards to lowPass3y/lowPass5y/lowPass9y, but allows the filter 00121 width to be selected at runtime. */ 00122 template <class T_or_RGB> 00123 Image<typename promote_trait<T_or_RGB, float>::TP> 00124 lowPassY(const int N, const Image<T_or_RGB>& src); 00125 00126 //! Apply a 3-pt median filter in the x direction 00127 template <class T_or_RGB> 00128 Image<T_or_RGB> median3x(const Image<T_or_RGB>& in); 00129 00130 //! Apply a 3-pt median filter in the y direction 00131 template <class T_or_RGB> 00132 Image<T_or_RGB> median3y(const Image<T_or_RGB>& in); 00133 00134 //! Apply a 3-pt median filter in the x and/or y directions; 00135 template <class T_or_RGB> 00136 Image<T_or_RGB> median3(const Image<T_or_RGB>& in, 00137 bool go_x = true, bool go_y = true); 00138 00139 //! convolve with a separable 2D gaussian 00140 template <class T_or_RGB> 00141 Image<typename promote_trait<T_or_RGB, float>::TP> 00142 convGauss(const Image<T_or_RGB>& src, const float sigmaX, const float sigmaY, 00143 const float threshperc); 00144 00145 // ###################################################################### 00146 /* So things look consistent in everyone's emacs... */ 00147 /* Local Variables: */ 00148 /* mode: c++ */ 00149 /* indent-tabs-mode: nil */ 00150 /* End: */ 00151 00152 #endif // IMAGE_LOWPASS_H_DEFINED