CLAM-Development
1.4.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
Processing
Analysis
Segmentator.hxx
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
3
* UNIVERSITAT POMPEU FABRA
4
*
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*
20
*/
21
22
#ifndef _Segmentator_hxx_
23
#define _Segmentator_hxx_
24
25
#include "
Processing.hxx
"
26
#include "
SegmentatorConfig.hxx
"
27
28
#include "
Matrix.hxx
"
29
/* TODO: this should be moved to the .cxx but a simple forward declaration
30
won't work, so the method Algorithm should be implemented in a different
31
way. since this will break the interface with possible subclasses, we
32
leave it for later. MDB
33
*/
34
35
namespace
CLAM
36
{
37
38
class
Segment;
39
class
SegmentDescriptors;
40
class
SegmentBoundaries;
41
42
enum
{
43
SpectralDescBase
=150,
//for example
44
SpectralMeanId
=
SpectralDescBase
,
45
SpectralGeometricMeanId
=
SpectralDescBase
+1,
46
SpectralEnergyId
=
SpectralDescBase
+2,
47
SpectralCentroidId
=
SpectralDescBase
+3,
48
SpectralMoment2Id
=
SpectralDescBase
+4,
49
SpectralMoment3Id
=
SpectralDescBase
+5,
50
SpectralMoment4Id
=
SpectralDescBase
+6,
51
SpectralMoment5Id
=
SpectralDescBase
+7,
52
SpectralMoment6Id
=
SpectralDescBase
+8,
53
SpectralFlatnessId
=
SpectralDescBase
+9,
54
SpectralKurtosisId
=
SpectralDescBase
+10,
55
56
FrameDescBase
= 175,
//for example
57
FundamentalId
=
FrameDescBase
,
58
59
SegmentatorBase
= 200,
//for example
60
MinSegmentLenghtId
=
SegmentatorBase
,
61
62
AudioDescriptorBase
= 250,
63
AudioMeanId
=
AudioDescriptorBase
,
64
AudioEnergyId
=
AudioDescriptorBase
+ 1,
65
AudioVarianceId
=
AudioDescriptorBase
+ 2,
66
AudioCentroidId
=
AudioDescriptorBase
+ 3,
67
AudioZeroCrossingRateId
=
AudioDescriptorBase
+ 4
68
};
69
70
71
class
Segmentator
:
public
Processing
72
{
73
public
:
74
Segmentator
();
75
Segmentator
(
const
SegmentatorConfig
& c);
76
virtual
~Segmentator
();
77
const
char
*
GetClassName
()
const
{
return
"Segmentator"
;}
78
const
ProcessingConfig
&
GetConfig
()
const
{
return
mConfig
;}
79
bool
Do
();
80
bool
Do
(
Segment
& originalSegment,
SegmentDescriptors
& descriptors);
//for the time being only inplace processing is enabled
81
82
protected
:
83
SegmentatorConfig
mConfig
;
84
private
:
85
void
DataFusion(
Segment
& s,
const
SegmentBoundaries& segmentBoundaries);
86
bool
ConcreteConfigure(
const
ProcessingConfig
& c);
87
/* All Algorithms should follow this prototype, taking as an input a segment and
88
// a Matrix where the descriptors values are stored
89
*/
90
virtual
void
Algorithm(
Segment
& s,
const
Matrix
& values);
91
protected
:
92
virtual
void
UnwrapDescriptors
(
const
Segment
& originalSegment,
SegmentDescriptors
& descriptors ,
Matrix
& descriptorsValues);
93
};
94
95
}
//namespace CLAM
96
97
#endif // _Segmentator_hxx_
98
Generated by
1.8.1