*** empty log message ***
[physik/nlsop.git] / linescan.c
1 /* linescan.c -- linescan @ width/2 */
2
3 /*
4  * author: frank.zirkelbach@physik.uni-augsburg.de
5  *
6  */
7
8 #define _GNU_SOURCE
9 #include <stdio.h>
10
11 #include <stdio.h>
12 #include "bmp.h"
13
14 int main(int argc,char **argv) {
15
16   t_bmp bmp;
17   int x,y;
18
19   if(argc!=2) {
20     printf("usage: %s <filename>\n",argv[0]);
21     return -1;
22   }
23
24   bmp_init(&bmp,2);
25   bmp.mode=READ;
26   strcpy(bmp.file,argv[1]);
27
28   bmp_read_file(&bmp);
29
30   dprintf(2,"width = %d\n",bmp.info.width);
31
32   x=bmp.info.width/2;
33   for(y=0;y<bmp.info.height;y++) {
34     printf("%f %d\n",1.0*(bmp.info.height/2-y)/(bmp.info.width*3),
35                      (bmp.map[x].r+bmp.map[x].g+bmp.map[x].b)/3);
36     x+=bmp.info.width;
37   }
38
39   bmp_shutdown(&bmp);
40
41   return 1;
42 }