# Filter a signal using FFT

I need to filter a signal without it losing its properties so that later that signal is inserted into an artificial neural network. I'm using the R and the signal library, I thought about using a low-pass filter or an FFT.

This is the signal to be filtered, it is about the displacement of pixels in a video, to each frame I get the distance covered by the pixels based on the previous frame. In case I calculated the result of vectors X and Y to get only one value and thus generate this graph / signal:

Using the signal library and the fftfilt function, I got the following signal, which seems to be easier for a neural network to be trained, but I did not understand what the function is doing and if the signal properties remained.

resulting <- fftfilt(rep(1,50)/50,resulting)


One could explain how this function works or suggest a better method to filter this signal without it losing its properties.

• I would guess "rep" does repetition, number 1 repeated 50 times divided by 50 is a very large primitive DC preserving low-pass filter. There is too few details to understand how everything is supposed to work. Also maybe the question is slightly more suitable for signal processing SE. – mathreadler Oct 3 '18 at 19:30
• You need to be more specific on what you are doing and what you are asking. Apparently, you want to process your signal without losing its "properties", but you do not specify which properties you are talking about. Then, you apply a (low pass) filter, implying that the properties are contained only in the low frequencies of the signal. However, it appears that you are not satisfied with the result (i.e., the properties are lost)! And in the end, you ask info about a filtering function, which is probably well documented. I also suggest asking signal processing SE after rewriting the question. – Stelios Oct 3 '18 at 20:08
• The signal is obtained from the displacement of pixels in a video, this signal represents a certain movement, larger movements generate signals with larger peaks and smaller movements generate smaller signals. In case the movement that I need to detect is contained in the low frequencies, so I would like to filter and leave only them, but I do not know if I did it correctly. – Douglas Ramos Oct 10 '18 at 19:18