nickgillian / grt

gesture recognition toolkit
859 stars 285 forks source link

Bug in HighPassFilter #99

Open codeflakes0 opened 7 years ago

codeflakes0 commented 7 years ago

Just realized why I kept getting zeros. In HighPassFilter.cpp

VectorFloat HighPassFilter::filter(const VectorFloat &x){
    ...
        yy[n] = filterFactor * (yy[n] + x[n] - xx[n]) * gain;
        xx[n] = x[n];
        processedData[n] = processedData[n];
    ...
}

should be something like this.

yy[n] = filterFactor * (yy[n] + x[n] - xx[n]) * gain;      
xx[n] = x[n];
processedData[n] = yy[n];

I did not have time to test it yet but I'm sure there's a problem there.

nickgillian commented 7 years ago

Yes, this was a bug in the high pass filter class, thanks for catching this!

I've pushed a fix to the dev branch, so if you check that out you can get direct access to the patch. I'll merge this to the master branch in a few days when some other changes in the dev branch have been cleaned up.