nickgillian / grt

gesture recognition toolkit
861 stars 284 forks source link

FFTFeatures returning the bottom N frequency values instead of the top values. #42

Open mcxsic opened 8 years ago

mcxsic commented 8 years ago

Hi Nick!

I am trying to use your library to detect some temporal gestures. I decided that a good way to extract features from a temporal sign is using the information from the FFT and the FFTFeatures. After trying to use it I realized that there might be something wrong with the FFTFeatures.cpp class. As it's stated here the last feature that the FFFeatures should return should be The top N frequency values. Instead, the function is returning the bottom N frequency values. After digging into the code I realized the the error is in the file grt/GRT/FeatureExtractionModules/FFT/FFTFeatures.cpp, at the line 28, where there's the following method defined:

bool sortIndexDoubleDecendingValue(IndexedDouble i,IndexedDouble j) { return (i.value<j.value); }

And it should be like this:

bool sortIndexDoubleDecendingValue(IndexedDouble i,IndexedDouble j) { return (i.value>j.value); }

Thanks!

Michel