Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ExampleFFT2D_Tiles.cpp
1 /* This file is part of the BIAS library (Basic ImageAlgorithmS).
2 
3  Copyright (C) 2003-2009 (see file CONTACT for details)
4  Multimediale Systeme der Informationsverarbeitung
5  Institut fuer Informatik
6  Christian-Albrechts-Universitaet Kiel
7 
8 
9  BIAS is free software; you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation; either version 2.1 of the License, or
12  (at your option) any later version.
13 
14  BIAS is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with BIAS; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/
22 
23 
24 /**
25  * @example ExampleFFT2D_Tiles.cpp
26  @relates FFT2D_Tiles
27  @brief Example for using the fast fourier Transform (FFT) Tiles
28  @ingroup g_examples
29  @author MIP
30 */
31 
32 #include <Image/FFT2D_Tiles.hh>
33 #include <Base/Image/Image.hh>
34 #include <Base/Image/ImageIO.hh>
35 #include <Base/Image/ImageConvert.hh>
36 
37 
38 using namespace std;
39 using namespace BIAS;
40 
41 
42 int main(int argc, char *argv[])
43 {
44 
45  if (argc!=2){
46  cerr << argv[0] << " <image>\n";
47  return -1;
48  }
49 
50  Image<unsigned char> im,imgrey, imgnew;
51  Image<float> res,r1,r2;
52 
53  if (ImageIO::Load(argv[1], im)!=0){
54  BIASERR("error loading image "<<argv[1]);
55  return -2;
56  }
57 
58  ImageConvert::ToGrey(im,imgrey);
59 // ImageIO::Save("grey",imgrey);
61 
62  fft.Init(imgrey.GetWidth(),imgrey.GetHeight(),32,32);
63 
64  // transform to 1 image with 1 channel, length of complex only
65  fft.TransformAbs(imgrey,res);
66 // ImageIO::Save("FFT2D-real",r1);
67 // ImageIO::Save("FFT2D-img",r2);
68 // fft.Normalize(res);
69  //ImageIO::Save("FFT2D-abs",res);
70  ImageIO::Save("FFT2D-abs",res);
71 
72 
73 
74  return 0;
75 }
virtual void Init(int, int)
Definition: FFT2D_Tiles.hh:54
Wrapper to the fftw3 library, which is supposed to perform the FFT patch- (tile-) wise...
Definition: FFT2D_Tiles.hh:47
unsigned int GetWidth() const
Definition: ImageBase.hh:312
virtual int TransformAbs(const Image< InputStorageType > &src, Image< OutputStorageType > &dst)
Transform forward and get absolute value from complex result The result is not normalized! ...
unsigned int GetHeight() const
Definition: ImageBase.hh:319