以下代码可以实现BMP灰度图到二维数组的转换
#include <stdio.h>
#define get ch=getc(in)
#define getdw ch=getc(in);ch=getc(in);ch=getc(in);ch=getc(in)
int chabiao(FILE *fp,unsigned char color);
int main(int argc, char *argv[])
{
FILE * in ,*out;
int j,l,k,a,cout,length,width,Alength,offset,ofs;
unsigned long i,filesize;
unsigned char ch,infile[10],outfile[]="$tmp.txt",flip[800];
unsigned char temp,tempR,tempG,tempB,newtemp;
//unsigned int ch;
printf("input bmp filename:");
scanf("%s",infile);
if((in=fopen(infile,"rb"))==NULL)
{
printf("can't open ");
exit(0);
}
if((out=fopen(outfile,"w"))==NULL)
{
printf("cann't open");
exit(0);
}&
BMP图象(灰度图)转化为二维数组的C语言实现(bmp2array)
最新推荐文章于 2025-05-23 12:42:00 发布