new TODOs
[physik/nlsop.git] / dft.c
diff --git a/dft.c b/dft.c
index 4bbbb46..1d26cee 100644 (file)
--- a/dft.c
+++ b/dft.c
@@ -12,15 +12,16 @@ int main(int argc,char **argv) {
   t_fourier fourier;
   t_bmp src;
   t_bmp dst;
+  t_bmp cut;
   int x,y;
   int offy,offt;
   int scale;
-  int help;
   double max;
   double *mag;
 
   bmp_init(&src,1);
   bmp_init(&dst,1);
+  bmp_init(&cut,1);
   src.mode=READ;
   dst.mode=WRITE;
   strcpy(src.file,argv[1]);
@@ -32,12 +33,14 @@ int main(int argc,char **argv) {
 
   bmp_read_file(&src);
 
-  dst.width=src.info.width;
-  dst.height=src.info.height;
+  bmp_cut_grab_bottom(&cut,&src,src.info.width,GRAB);
+
+  dst.width=cut.width;
+  dst.height=cut.height;
   bmp_alloc_map(&dst);
 
-  fourier.data_len[0]=src.info.width;
-  fourier.data_len[1]=src.info.height;
+  fourier.data_len[0]=cut.width;
+  fourier.data_len[1]=cut.height;
   fourier_alloc_data(&fourier);
 
   mag=(double *)malloc(fourier.data_len[0]*fourier.data_len[1]*sizeof(double));
@@ -82,9 +85,11 @@ int main(int argc,char **argv) {
     offt=0;
     for(y=0;y<dst.height;y++) {
       for(x=0;x<dst.width;x++) {
+       // usual image processing order
         offy=((y<dst.height/2)?y+dst.height/2:y-dst.height/2);
         offy*=dst.width;
         offy+=((x<dst.width/2)?x+dst.width/2:x-dst.width/2);
+       //offy=offt;
         dst.map[offy].r=scale*mag[offt];
         dst.map[offy].g=dst.map[offy].r;
         dst.map[offy].b=dst.map[offy].r;