用C语言怎么读取BMP格式的图片

这个图片已经处理成二值图像了,有没有语句读取这个图片文件
2024-12-20 10:17:56
推荐回答(3个)
回答1:

没有标准函数读。
需要根据BMP文件的结构定义,读出头部和每个颜色值。
struct header
{
unsigned short int bfType;
unsigned int bfSize;
unsigned short int bfReserved1;
unsigned short int bfReserved2;
unsigned int bfoffBits;
}__attribute__ ((packed));

struct tinfoheader
{
unsigned int biSize;
unsigned int biWidth;
unsigned int biHeight;
unsigned short int biPlanes;
unsigned short int biBitCount;
unsigned int biCompression;
unsigned int biSizeImage;
unsigned int biXPelsPerMeter;
unsigned int biYPelsPerMeter;
unsigned int biClrUsed;
unsigned int biClrImportant;
}__attribute__ ((packed));

回答2:

可以调用系统消息处理函数

回答3:

读它像素点的值是吗?