- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
GIS数字图像的处理
GIS数字图像处理;数字图像的基本概念;数字图像的存储结构;数字图像的存储结构;遥感数字图像的存储结构;遥感数字图像的存储结构;遥感数字图像的存储结构;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 st
文档评论(0)