;数字图像的基本概念;数字图像的存储结构;数字图像的存储结构;遥感数字图像的存储结构;遥感数字图像的存储结构;遥感数字图像的存储结构;void Image :: InitImage( )
{
ImageRows = ImageCols = 0;
Pixel = NULL;
}
void Image :: DeleteImage( )
{
if ( Pixel != NULL )
delete [ ] Pixel;
};创建一个灰度数字图像:
bool Image :: CreateImage( int Rows, int Cols, unsigned char Gray )
{
DeleteImage( );
Pixel = new unsigned char[ Rows * Cols ];
if ( Pixel == NULL )
return false;; ImageRows = Rows;
ImageCols = Cols;
for ( int i = 0; i Rows; i ++ )
for ( int j = 0; j Cols; j ++ )
Pixel[ i * Cols + j ] = Gray;
return true;
};设置一个像素的灰度
void Image :: SetAPixel( int i, int j, unsigned char Gray )
{
if ( i ImageRows j ImageCols )
Pixel [ i * ImageCols + j ] = Gray;
};获取一个像素的灰度
unsigned char Image :: GetAPixel( int i, int j )
{
if ( i ImageRows j ImageCols )
return Pixel [ i * ImageCols + j ];
};显示一个灰度图像
void Image :: ShowImage( int x, int y )
{
for ( int i = 0; i ImageRows; i ++ )
for ( int j = 0; j ImageCols; j ++ )
{ unsigned char gray = Pixel[ i * ImageCols + j ];
DrawPoint( x + j, ScrHeight - y - i, RGB( gray, gray, gray ) );
}
} // ScrHeight:屏幕高度;遥感数字图像的存储结构;从图像文件中读入图像数据
bool Image :: LoadAnImage( char* FileName )
{
// ……
};BMP图像文件格式:
一个BMP图像文件一般分成4个部分:
位图文件头:BITMAPFILEHEADER;
位图信息头:BITMAPINFOHEADER;
调色板:Palette;
图像像素数据:Pixels.;位图文件头:BITMAPFILEHEADER
Typedef struct tagBITMAPFILEHEADER
{
WORD bfType; // 0x424d 即“BM”
DWORD bfSize; // 文件大小字节数
WORD bfReserved1, bfReserved2;
DWORD bfOffBits; // 像素数据偏移字节
}
BITMAPFILEHEADER;;位图信息头:BITMAPINFOHEADER
typedef struct tagBITMAPINFOHEADER
{ DWORD biSize; // 该结构长度,40字节
LONG biWidth; // 图像宽度,单位是像素
LONG biHeight; // 图像高度,单位是像素
WORD biPlanes; // 1
WORD biBitCount; // 1,4,8,24
DWORD biCompression; // BI_RGB
DWORD biSizeImage; // 位图字节数=宽*高
LONG biXPelsPerMeter; // 水平分辨率
LONG biYPelsPerMeter; // 垂直分辨率
DWORD biClrUsed; // 实际颜色数,0…
DWORD biClrImportant; // 重要颜色数,0…
} BITMAPINFOHEADER; ;调色板
typedef struct tagR
您可能关注的文档
最近下载
- 《半个月,搭建你的英语语法体系》全部课件.pdf
- ASME B16.47-2017整体法兰尺寸及公差.pdf
- 《中小学校长校园食品安全管理应知应会20条》培训与解读课件.pptx VIP
- 智鼎在线测评系统操作.pdf VIP
- 医科大学高层次人才年度(中期、聘期)考核表.doc VIP
- 红糖的生产工艺课件.ppt VIP
- 2026年对照围绕在带头强化政治忠诚、提高政治能力等“五个带头”方面对照检查材料【2篇文】供参考.docx VIP
- 过二硫酸铵-安全技术说明书MSDS.docx VIP
- 高可用性设计指南.docx VIP
- 紫皮大蒜和白皮大蒜中大蒜素含量的對比08科三马杏贤许爱娟叶晓阳.doc VIP
原创力文档

文档评论(0)