21 #define GRT_DLL_EXPORTS 27 std::string EnvelopeExtractor::id =
"EnvelopeExtractor";
37 if( bufferSize > 0 && numDimensions > 0 ){
38 init( bufferSize, numDimensions );
55 this->bufferSize = rhs.bufferSize;
56 this->buffer = rhs.buffer;
66 if( featureExtraction == NULL )
return false;
68 if( this->
getId() == featureExtraction->
getId() ){
77 errorLog <<
"deepCopyFrom(FeatureExtraction *featureExtraction) - FeatureExtraction Types Do Not Match!" << std::endl;
84 if( !initialized )
return false;
90 for(UINT j=0; j<numInputDimensions; j++){
92 for(UINT i=0; i<count; i++){
93 featureVector[j] += SQR( buffer[i][j] );
95 featureVector[j] = sqrt( featureVector[j] / count );
99 featureDataReady =
true;
110 if( !file.is_open() ){
111 errorLog <<
"save(fstream &file) - The file is not open!" << std::endl;
116 file <<
"ENVELOPE_EXTRACTOR_FILE_V1.0" << std::endl;
120 errorLog <<
"save(fstream &file) - Failed to save base feature extraction settings to file!" << std::endl;
124 file <<
"BufferSize: " << bufferSize << std::endl;
133 if( !file.is_open() ){
134 errorLog <<
"load(fstream &file) - The file is not open!" << std::endl;
142 if( word !=
"ENVELOPE_EXTRACTOR_FILE_V1.0" ){
143 errorLog <<
"load(fstream &file) - Invalid file format!" << std::endl;
149 errorLog <<
"loadFeatureExtractionSettingsFromFile(fstream &file) - Failed to load base feature extraction settings from file!" << std::endl;
155 if( word !=
"BufferSize:" ){
156 errorLog <<
"load(fstream &file) - Failed to read BufferSize header!" << std::endl;
161 return init( bufferSize, numInputDimensions );
168 if( bufferSize == 0 || numDimensions == 0 )
return false;
170 this->bufferSize = bufferSize;
171 numInputDimensions = numDimensions;
172 numOutputDimensions = numDimensions;
bool push_back(const T &value)
std::string getId() const
unsigned int getNumValuesInBuffer() const
bool resize(const unsigned int newBufferSize)