i am converting 24bit rgb bmp image into 8bit greyscale. i am reading the r,g and b values of each pixel and then taking its average. then i am storing it in the greys matrix. but i dnt know why the program does not come to an end. it keeps on displaying the numbers and doesnto stop. kindly help
Code:void grey (void) { fp= fopen("c:\\d.bmp", "r"); unsigned int rw, co, r,g,b, greys[1200][1600]; for (rw=0; rw<=1200; rw++) for (co=0; co<=1600; co++) { r=fgetc(fp); g=fgetc(fp); b=fgetc(fp); greys[rw][co]= (r+g+b)/3; cout <<greys[rw][co]<<" "; } }



LinkBack URL
About LinkBacks



