資源簡介
剛學數字圖像處理,簡單的寫了個讀取圖像的C++程序,希望對大家有幫助~~
代碼片段和文件信息
#include?
#include?
#include?
#include?
#include?
#include?
unsigned?char?*pBmpBuf;
int?bmpWidthbmpHeight;
RGBQUAD?*pColorTable;
int?biBitCount;
bool?readBmp(char?*bmpName)
{
FILE?*fp=fopen(bmpName“rb“);//二進制方式打開指定的圖像文件
if(fp==0)?return?0;
fseek(fpsizeof(BITMAPFILEHEADER)0);//跳過位圖的文件頭結構
BITMAPINFOHEADER?head;
fread(&headsizeof(BITMAPINFOHEADER)1fp);//將文件頭信息存入head中
bmpWidth?=?head.biWidth;?//獲取圖像寬等信息
????bmpHeight?=?head.biHeight;//獲取圖像高
????biBitCount?=?head.biBit
- 上一篇:嚴蔚敏建立詞索引表
- 下一篇:HT1622程序例程
評論
共有 條評論