Bilinear interpolation in Swift

789 Views Asked by At

I am currently working on implementing spectrogram and the input to it are output from FFT. The results which I am getting is very pixelated. To make the output more smooth, I need to implement bilinear interpolation.

Is there any library or API readily available for it?

I found a function samplingLinear() in CoreImage which samples an image using bilinear interpolation. However, I need to interpolate the FFT data instead of an image.

Any help will be greatly appreciated.Spectrogram_Sample

Thanks.

1

There are 1 best solutions below

0
On

Assuming you're displaying the data via OpenGL/CoreAnimation/UIImageView, you should do the interpolation there.

E.g. if you're displaying the data via a CALayer, you can set the magnificationFilter to kCAFilterLinear. If you're using OpenGL, you can set GL_TEXTURE_MAG_FILTER to GL_LINEAR.