+/* 3dplot.c -- 3d plot bmp image */
+
+/*
+ * author: frank.zirkelbach@physik.uni-augsburg.de
+ *
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+
+#include <stdio.h>
+#include "bmp.h"
+
+int main(int argc,char **argv) {
+
+ t_bmp bmp;
+ int x,y;
+ int help;
+ int val;
+
+ if(argc!=2) {
+ printf("usage: %s <filename>\n",argv[0]);
+ return -1;
+ }
+
+ bmp_init(&bmp,2);
+ bmp.mode=READ;
+ strcpy(bmp.file,argv[1]);
+
+ bmp_read_file(&bmp);
+
+ dprintf(2,"width = %d\n",bmp.info.width);
+
+ for(x=0;x<bmp.info.width;x++) {
+ for(y=0;y<bmp.info.height;y++) {
+ help=y*bmp.info.width+x;
+ val=(bmp.map[help].r+bmp.map[help].g+bmp.map[help].b)/3;
+ if(val!=0)
+ printf("%f %f %d\n",1.0*(x-bmp.info.width/2)/(bmp.info.width*3),
+ 1.0*(y-bmp.info.height/2)/(bmp.info.height*3),val);
+ }
+ }
+
+ bmp_shutdown(&bmp);
+
+ return 1;
+}