C语言打开图像文件后运用以下代码就可以读取像素,具体如下:
#ifndef?IMAGE_H
#define?IMAGE_H
void?image_info(FILE*?file);
void?image_save(FILE?*file);
void?image_gray();
void?image_binarization();
void?image_opposite();
void?image_channel();?//抽取RGB通道
void?image_bright();//改变图像亮度
typedef?struct?BMP
{
//14字节
unsigned?short?bfType;?//文件标识?2字节?必须为BM?
unsigned?int?bfSize;?//文件大小?4字节?
unsigned?short?bfReserved1;?//保留,每字节以"00"填写?2字节?
unsigned?short?bfReserved2;?//同上?2字节?
unsigned?int?bfOffBits;?//记录图像数据区的起始位置(图象数据相对于文件头字节的偏移量)。
?4字节
//40字节
unsigned?int?biSize;?//表示本结构的大小?4字节?
int?biWidth;?//位图的宽度?4字节?
int?biHeight;?//位图的高度?4字节?
unsigned?short?biPlanes;?//永远为1?,?2字节?
unsigned?short?biBitCount;?//位图的位数?分为1?4?8?16?24?32?2字节?
unsigned