#include <stdio.h>
#include "bmp.h"
+#define DX (3)
+
int main(int argc,char **argv) {
t_bmp bmp;
- int x,y;
+ int x,y,d;
+ double val;
if(argc!=2) {
printf("usage: %s <filename>\n",argv[0]);
bmp_read_file(&bmp);
- dprintf(2,"width = %d\n",bmp.info.width);
+ dprintf(2,"width = %d ... delta x = %d.\n",bmp.info.width,DX);
x=bmp.info.width/2;
for(y=0;y<bmp.info.height;y++) {
- printf("%f %d\n",1.0*(bmp.info.height/2-y)/(bmp.info.width*3),
- (bmp.map[x].r+bmp.map[x].g+bmp.map[x].b)/3);
+ val=0.0;
+ for(d=-DX;d<=DX;d++)
+ val+=(1.0*(bmp.map[x+d].r+bmp.map[x+d].g+bmp.map[x+d].b)/3);
+ printf("%f %f\n",1.0*(bmp.info.height/2-y)/(bmp.info.width*3),val);
+ //printf("%f %f\n",1.0*(bmp.info.height/2-y)/(bmp.info.width),val);
x+=bmp.info.width;
}