/home/neoflo/smb4k/SERVEUR/Millie/trunk/src/MillieStd.hpp

Aller à la documentation de ce fichier.
00001 /******************************************************************************
00002  *       __    _    _   _       _       _   _____                             *
00003  *       | \  / |  | | | |     | |     | |  | ___|                            *
00004  *       |  \/  |  | | | |     | |     | |  | |_                              *
00005  *       |      |  | | | |     | |     | |  |  _|                             *
00006  *       | |\/| |  | | | |__   | |__   | |  | |__                             *
00007  *       |_|  |_|  |_| |____|  |____|  |_|  |____|                            *
00008  * __________________________________________________________________________ *
00009  *                 Multifunctional Library For Image Processing               *
00010  *                                                                            *
00011  *                                                                            *
00012  *                                                                            *
00013  *      (c) Copyright 2007 by Humbert Florent                                 *
00014  *                                                                            *
00015  *      This program is free software; you can redistribute it and/or modify  *
00016  *      it under the terms of the GNU General Public License as published by  *
00017  *      the Free Software Foundation; only version 2 of the License.          *
00018  *                                                                            *
00019  *      This program is distributed in the hope that it will be useful,       *
00020  *      but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00021  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00022  *      GNU General Public License for more details.                          *
00023  *                                                                            *
00024  *      You should have received a copy of the GNU General Public License     *
00025  *      along with this program; if not, write to the Free Software           *
00026  *      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA             *
00027  *      02111-1307, USA.                                                      *
00028  ******************************************************************************/
00029 
00032 #ifndef _MILLIESTD_HPP_
00033 #define _MILLIESTD_HPP_
00034 
00035 #include "DataBuffer.hpp"
00036 #include <vector>
00037 
00038 /*définie un ensemble de fonction standard*/
00039 namespace Millie
00040 {
00041 
00049   float getMinimum(DataBuffer<float>& buffer);
00050 
00058   float getMinimum(std::vector<float>& vect);
00059 
00067   float getMaximum(DataBuffer<float>& buffer);
00068 
00076   float getMaximum(std::vector<float>& vect);
00077 
00085   float getAverage(std::vector<float> & vect);
00086 
00094   float getAverage(DataBuffer<float>& buffer);
00095 
00103   float getVariance(std::vector<float> & vect);
00104 
00112   float getVariance(DataBuffer<float> & buffer);
00113 
00117   class Math
00118   {
00119     public:
00128       static float sign(float a)
00129       {
00130         if(a<0)
00131           return -1.0f;
00132         if(norm(a)==0.00)
00133           return 0.0f;
00134         return 1.0f;
00135       }
00136 
00142       template<typename T>
00143       static T square(T a)
00144       {
00145         return (a*a);
00146       }
00147 
00148 
00154       static float norm(float a)
00155       {
00156         if(a<0)
00157           return -a;
00158         else
00159           return a;
00160       }
00161 
00176       static float minmod(float a, float b)
00177       {
00178         return 0.5* (sign(a) + sign(b)) * (norm(a) < norm(b) ? norm(a) : norm(b));
00179         /*     if(a*b>0)
00180               return std::min(norm(a),norm(b));
00181              else
00182               return 0;
00183           */
00184       }
00185 
00200       static float maxmod(float a, float b)
00201       {
00202         return 0.5* (sign(a) + sign(b)) * (norm(a) > norm(b) ? norm(a) : norm(b));
00203       }
00204 
00205 
00206   };
00207 
00208 };
00209 
00210 #endif

Généré le Fri May 18 23:24:34 2007 pour Millie par  doxygen 1.5.1