Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an equivalent of the matlab 'idealfilter' for Python in Scipy (or other libraries)?

I am looking for an equivalent of the time series idealfilter that is implemented in Matlab, for Python.

My goal is to implement an ideal filter using Discrete Cosine Transform as is used in the Eulerian Video Magnification paper in Python in order to obtain the heartbeat of a human being from standard video. I am using their video as my input and I have implemented the bandpass filter method, but I have not been able to find an idealfilter method to use in my script.

They state that they implement an ideal filter using DCT from 0.83 - 1.0Hz.

My problem is that the idealfilter in Matlab takes in as input the cutoff frequencies, but I don't think it is implemented with dct.

In contrast, the DCT filter found in scipy.fftpack does not take in as input the frequency cutoffs.

If I have to use these in some type of succession please let me know.

If such a function equivalent exists I would like to attempt to use it in order to see if it yields similar results to what they have obtained.

like image 839
Daniel Castro Avatar asked Sep 14 '12 00:09

Daniel Castro


1 Answers

Non-causal means that your filter depends on future inputs. DCT is a transform, not a filter. You want a filter.

You want to apply a bandpass filter to your data within the range you specified, so I would use a butterworth filter.

Here is some example code: https://stackoverflow.com/a/12233959/1097117

The trickiest part of all of this is getting everything in terms of your Nyquist frequency.

like image 120
JesseBikman Avatar answered Sep 22 '22 18:09

JesseBikman