I have one signal y. The signal gets values from 0 to 1. The signal is actually derived from the red channel (from RGB) from a smartphone's camera, normalized by mapping all values from the space [0,1,... 255] to the space [0 - 1] by dividing by 255. I have another array x for storing the camera frames 0,1,2,3,... What I want to do is to convert the signal y from time domain to the frequency domain using Java. I have tried to use the class provided here.
My code is
fftsize = powtwo(y.size()); //keep samples of a size of power of 2
Float[] rp = new Float[fftsize]; //rp is real part of signal (= y)
for(int i=0; i<fftsize; i++){
rp[i]=y.get(i);
}
Float[] ip = new Float[fftsize]; //ip is the imaginary part of signal = 0
for(int i=0; i<fftsize;i++){
ip[i]=0.0f;
}
fft(rp,ip);
where
public int powtwo(int size){ //this function estimates the next power of 2 (below the given int value).
while(!(Math.sqrt((double)size)-(int)Math.sqrt((double)size) == 0)){
size--;
}
return size;
}
I'm not sure if I'm doing it right and I don't know the next steps for turning FFT to frequency domain signal.