Mercurial > hg > qm-dsp
comparison dsp/segmentation/ClusterMeltSegmenter.h @ 20:8bdbda7fb893
* First cut at properly integrating the segmenter and making it work right
author | cannam |
---|---|
date | Wed, 09 Jan 2008 16:50:04 +0000 |
parents | 8e90a56b4b5f |
children | 2b74bd60c61f |
comparison
equal
deleted
inserted
replaced
19:d3a856b44c43 | 20:8bdbda7fb893 |
---|---|
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "segment.h" | 12 #include "segment.h" |
13 #include "Segmenter.h" | 13 #include "Segmenter.h" |
14 #include "hmm.h" | 14 #include "hmm/hmm.h" |
15 #include "lib_constQ.h" | 15 #include "base/Window.h" |
16 #include "dsp/chromagram/ConstantQ.h" | |
16 | 17 |
17 using std::vector; | 18 using std::vector; |
18 | 19 |
19 class ClusterMeltSegmenterParams // defaults are sensible for 11025Hz with 0.2 second hopsize | 20 class ClusterMeltSegmenterParams // defaults are sensible for 11025Hz with 0.2 second hopsize |
20 { | 21 { |
38 { | 39 { |
39 public: | 40 public: |
40 ClusterMeltSegmenter(ClusterMeltSegmenterParams params); | 41 ClusterMeltSegmenter(ClusterMeltSegmenterParams params); |
41 virtual ~ClusterMeltSegmenter(); | 42 virtual ~ClusterMeltSegmenter(); |
42 virtual void initialise(int samplerate); | 43 virtual void initialise(int samplerate); |
43 virtual int getWindowsize() { return static_cast<int>(windowSize * samplerate); } | 44 virtual int getWindowsize(); |
44 virtual int getHopsize() { return static_cast<int>(hopSize * samplerate); } | 45 virtual int getHopsize(); |
45 virtual void extractFeatures(double* samples, int nsamples); | 46 virtual void extractFeatures(double* samples, int nsamples); |
46 void setFeatures(const vector<vector<double> >& f); // provide the features yourself | 47 void setFeatures(const vector<vector<double> >& f); // provide the features yourself |
47 virtual void segment(); // segment into default number of segment-types | 48 virtual void segment(); // segment into default number of segment-types |
48 void segment(int m); // segment into m segment-types | 49 void segment(int m); // segment into m segment-types |
49 int getNSegmentTypes() { return nclusters; } | 50 int getNSegmentTypes() { return nclusters; } |
50 protected: | 51 protected: |
51 //void mpeg7ConstQ(); | 52 //void mpeg7ConstQ(); |
52 void makeSegmentation(int* q, int len); | 53 void makeSegmentation(int* q, int len); |
53 | 54 |
54 double* window; | 55 Window<double> *window; |
55 int windowLength; // in samples | 56 // int windowLength; // in samples |
56 constQ_t* constq; | 57 ConstantQ* constq; |
57 model_t* model; // the HMM | 58 model_t* model; // the HMM |
58 //vector<int> stateSequence; | 59 //vector<int> stateSequence; |
59 //vector<int> segmentTypeSequence; | 60 //vector<int> segmentTypeSequence; |
60 int* q; // the decoded HMM state sequence | 61 int* q; // the decoded HMM state sequence |
61 vector<vector<double> > histograms; | 62 vector<vector<double> > histograms; |