简体   繁体   中英

How I should create complex number from image data for Fast Fourier Transform (fft, swift)?

I have array of grayscale for example [0.0, 0.0, 0.0, 255.0, 255.0, 255.0, 130.0, 130.0, 130.0] 3x3 dimension, I need create array of complex numbers for fft function. How I should convert this array? Im using swift 4 and it is for iOS, but I think its no matter. And also using Accelerate framework from Apple

so have 3 questions

  1. How I should convert this array?
  2. Is there any common theory how do it?
  3. How should I do it for RGB when working with channels?

Fill real part of complex array with you data, and imaginary part - with zero (picture is pure real data).

After FFT you'll have complex array (symmetrical because of pure real source). Both real and im. parts of result are important. For example, you can use both parts to calculate magnitude of spectrum, or to perform some treatment in frequency domain and make inverse FFT to get treated picture.

What to do with RGB - depends on your needs. Sometimes one needs to perform FFT on every channel separately. Sometimes one needs to work with brightness - in this case channels are joined using some law.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM