| 245 | } |
| 246 | |
| 247 | bool IPLComplexImage::IFFT() |
| 248 | { |
| 249 | if( _width != _height ) return false; |
| 250 | int size = IPLComplexImage::nextPowerOf2(_width); |
| 251 | if( size != _width ) return false; |
| 252 | |
| 253 | Complex* twiddle = new Complex [size/2]; |
| 254 | iTwiddle( twiddle, size/2 ); |
| 255 | for( int y=0; y<size; y++ ) |
| 256 | { |
| 257 | lineFFT(_plane[y], twiddle, size); |
| 258 | } |
| 259 | flip(); |
| 260 | for( int y=0; y<size; y++ ) |
| 261 | { |
| 262 | lineFFT(_plane[y], twiddle, size); |
| 263 | } |
| 264 | /*delete [] twiddle; |
| 265 | double height_2 = (double)_height * (double)_height; |
| 266 | for( int x=0; x<size; x++ ) |
| 267 | for( int y=0; y<size; y++ ) |
| 268 | p(x,y) /= height_2;*/ |
| 269 | return true; |
| 270 | } |
| 271 | |
| 272 | void IPLComplexImage::lineFFT(Complex* x, Complex* twiddle, int N) |
| 273 | { |