Segmentator.hxx

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
00003  *                         UNIVERSITAT POMPEU FABRA
00004  *
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 #ifndef _Segmentator_hxx_
00023 #define _Segmentator_hxx_
00024 
00025 #include "Processing.hxx"
00026 #include "SegmentatorConfig.hxx"
00027 
00028 #include "Matrix.hxx"
00029 /* TODO: this should be moved to the .cxx but a simple forward declaration
00030          won't work, so the method Algorithm should be implemented in a different
00031          way. since this will break the interface with possible subclasses, we 
00032          leave it for later. MDB
00033 */
00034 
00035 namespace CLAM
00036 {
00037 
00038 class Segment;
00039 class SegmentDescriptors;
00040 class SegmentBoundaries;
00041 
00042 enum {
00043         SpectralDescBase=150, //for example
00044         SpectralMeanId = SpectralDescBase,
00045         SpectralGeometricMeanId = SpectralDescBase+1,
00046         SpectralEnergyId = SpectralDescBase+2,
00047         SpectralCentroidId = SpectralDescBase+3,
00048         SpectralMoment2Id = SpectralDescBase+4,
00049         SpectralMoment3Id = SpectralDescBase+5,
00050         SpectralMoment4Id = SpectralDescBase+6,
00051         SpectralMoment5Id = SpectralDescBase+7,
00052         SpectralMoment6Id = SpectralDescBase+8,
00053         SpectralFlatnessId = SpectralDescBase+9,
00054         SpectralKurtosisId = SpectralDescBase+10,
00055 
00056         FrameDescBase = 175, //for example
00057         FundamentalId = FrameDescBase,
00058 
00059         SegmentatorBase = 200, //for example
00060         MinSegmentLenghtId = SegmentatorBase,
00061 
00062         AudioDescriptorBase = 250,
00063         AudioMeanId = AudioDescriptorBase,
00064         AudioEnergyId = AudioDescriptorBase + 1,
00065         AudioVarianceId = AudioDescriptorBase + 2,
00066         AudioCentroidId = AudioDescriptorBase + 3,
00067         AudioZeroCrossingRateId = AudioDescriptorBase + 4
00068 };
00069 
00070 
00071 class Segmentator : public Processing
00072 {
00073 public:
00074         Segmentator();
00075         Segmentator(const SegmentatorConfig& c);
00076         virtual ~Segmentator();
00077         const char * GetClassName() const {return "Segmentator";}
00078         const ProcessingConfig& GetConfig() const {return mConfig;}
00079         bool Do();
00080         bool Do(Segment& originalSegment,SegmentDescriptors& descriptors); //for the time being only inplace processing is enabled
00081 
00082 protected:
00083         SegmentatorConfig  mConfig;
00084 private:
00085         void DataFusion(Segment& s,const SegmentBoundaries& segmentBoundaries);
00086         bool ConcreteConfigure(const ProcessingConfig& c);
00087         /* All Algorithms should follow this prototype, taking as an input a segment and
00088         // a Matrix where the descriptors values are stored
00089         */
00090         virtual void Algorithm(Segment& s,const Matrix& values);
00091 protected:
00092         virtual void UnwrapDescriptors(const Segment& originalSegment,SegmentDescriptors& descriptors ,Matrix& descriptorsValues);
00093 };
00094 
00095 } //namespace CLAM
00096 
00097 #endif // _Segmentator_hxx_
00098 
Generated by  doxygen 1.6.3