基于C#写的遥感图像处理的课程设计程序,实现了影像读取,影像滤波,影像几何校正和影像分类,完美实现老师的要求。
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 929 2017-06-27 07:19 RS.sln
文件 58368 2017-06-27 09:52 RS.v12.suo
文件 1787904 2014-09-11 08:12 tif7.suo
文件 55808 2017-06-27 07:20 tif7.v12.suo
目录 0 2017-11-07 15:23 tif7
目录 0 2017-11-07 15:23 tif7in
目录 0 2017-11-07 15:23 tif7inDebug
文件 1951744 2013-04-13 19:54 tif7inDebugcairo.dll
文件 1152512 2010-10-25 14:52 tif7inDebugcfitsio.dll
文件 8192 2014-05-08 11:34 tif7inDebugcreatedata.exe
文件 65024 2012-01-01 13:31 tif7inDebugfreexl.dll
文件 121856 2010-10-25 14:54 tif7inDebugfribidi.dll
文件 544768 2010-10-25 15:09 tif7inDebugftgl.dll
文件 13827584 2014-05-08 11:29 tif7inDebuggdal111.dll
文件 80384 2014-05-08 11:34 tif7inDebuggdal_csharp.dll
文件 140800 2014-05-08 11:34 tif7inDebuggdal_wrap.dll
文件 8192 2014-05-08 11:34 tif7inDebugGDALAdjustContrast.exe
文件 5632 2014-05-08 11:34 tif7inDebugGDALColorTable.exe
文件 19456 2014-05-08 11:34 tif7inDebuggdalconst_csharp.dll
文件 12800 2014-05-08 11:34 tif7inDebuggdalconst_wrap.dll
文件 5120 2014-05-08 11:34 tif7inDebugGDALCreateCopy.exe
文件 7168 2014-05-08 11:34 tif7inDebugGDALDatasetRasterIO.exe
文件 5120 2014-05-08 11:34 tif7inDebugGDALDatasetWrite.exe
文件 5632 2014-05-08 11:34 tif7inDebugGDALGetHistogram.exe
文件 9216 2014-05-08 11:34 tif7inDebugGDALInfo.exe
文件 5632 2014-05-08 11:34 tif7inDebugGDALMemDataset.exe
文件 6656 2014-05-08 11:34 tif7inDebugGDALOverviews.exe
文件 8704 2014-05-08 11:34 tif7inDebugGDALRead.exe
文件 8704 2014-05-08 11:34 tif7inDebugGDALReadDirect.exe
文件 5120 2014-05-08 11:34 tif7inDebugGDALWrite.exe
文件 1243648 2013-11-18 09:18 tif7inDebuggeos.dll
............此处省略123个文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using OSGeo.GDAL;
namespace RS
{
public partial class Classification : Form
{
public Classification()
{
InitializeComponent();
}
public Bitmap GetRGBImage(OSGeo.GDAL.Dataset ds1 Rectangle showRect1 int[] bandlist1)
{
int imgWidth = ds1.RasterXSize; //影像宽
int imgHeight = ds1.RasterYSize; //影像高
float ImgRatio = imgWidth / (float)imgHeight; //影像宽高比
//获取显示控件大小
int BoxWidth = showRect1.Width;
int BoxHeight = showRect1.Height;
float BoxRatio = imgWidth / (float)imgHeight; //显示控件宽高比
//计算实际显示区域大小,防止影像畸变显示
int BufferWidth BufferHeight;
if (BoxRatio >= ImgRatio)
{
BufferHeight = BoxHeight;
BufferWidth = (int)(BoxHeight * ImgRatio);
}
else
{
BufferWidth = BoxWidth;
BufferHeight = (int)(BoxWidth / ImgRatio);
}
//构建位图
Bitmap bitmap = new Bitmap(BufferWidth BufferHeight
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
if (bandlist1.Length == 3) //RGB显示
{
int[] r = new int[BufferWidth * BufferHeight];
Band band1 = ds1.GetRasterBand(bandlist1[0]);
band1.ReadRaster(0 0 imgWidth imgHeight r BufferWidth BufferHeight 0 0); //读取图像到内存
//为了显示好看,进行最大最小值拉伸显示
double[] maxandmin1 = { 0 0 };
band1.ComputeRasterMinMax(maxandmin1 0);
int[] g = new int[BufferWidth * BufferHeight];
Band band2 = ds1.GetRasterBand(bandlist1[1]);
band2.ReadRaster(0 0 imgWidth imgHeight g BufferWidth BufferHeight 0 0);
double[] maxandmin2 = { 0 0 };
band2.ComputeRasterMinMax(maxandmin2 0);
int[] b = new int[BufferWidth * BufferHeight];
Band band3 = ds1.GetRasterBand(bandlist1[2]);
band3.ReadRaster(0 0 imgWidth imgHeight b BufferWidth BufferHeight 0 0);
double[] maxandmin3 = { 0 0 };
band3.ComputeRasterMinMax(maxandmin3 0);
int i j;
for (i = 0; i < BufferWidth; i++)
{
for (j = 0; j < BufferHeight; j++)
{
int rVal = Convert.ToInt32(r[i + j * BufferWidth]);
rVal = (int)((rVal - maxandmin1[0]) / (maxandmin1[1] - maxandmin1[0]) * 255);
int gVal = Convert.ToInt32(g[i + j
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 929 2017-06-27 07:19 RS.sln
文件 58368 2017-06-27 09:52 RS.v12.suo
文件 1787904 2014-09-11 08:12 tif7.suo
文件 55808 2017-06-27 07:20 tif7.v12.suo
目录 0 2017-11-07 15:23 tif7
目录 0 2017-11-07 15:23 tif7in
目录 0 2017-11-07 15:23 tif7inDebug
文件 1951744 2013-04-13 19:54 tif7inDebugcairo.dll
文件 1152512 2010-10-25 14:52 tif7inDebugcfitsio.dll
文件 8192 2014-05-08 11:34 tif7inDebugcreatedata.exe
文件 65024 2012-01-01 13:31 tif7inDebugfreexl.dll
文件 121856 2010-10-25 14:54 tif7inDebugfribidi.dll
文件 544768 2010-10-25 15:09 tif7inDebugftgl.dll
文件 13827584 2014-05-08 11:29 tif7inDebuggdal111.dll
文件 80384 2014-05-08 11:34 tif7inDebuggdal_csharp.dll
文件 140800 2014-05-08 11:34 tif7inDebuggdal_wrap.dll
文件 8192 2014-05-08 11:34 tif7inDebugGDALAdjustContrast.exe
文件 5632 2014-05-08 11:34 tif7inDebugGDALColorTable.exe
文件 19456 2014-05-08 11:34 tif7inDebuggdalconst_csharp.dll
文件 12800 2014-05-08 11:34 tif7inDebuggdalconst_wrap.dll
文件 5120 2014-05-08 11:34 tif7inDebugGDALCreateCopy.exe
文件 7168 2014-05-08 11:34 tif7inDebugGDALDatasetRasterIO.exe
文件 5120 2014-05-08 11:34 tif7inDebugGDALDatasetWrite.exe
文件 5632 2014-05-08 11:34 tif7inDebugGDALGetHistogram.exe
文件 9216 2014-05-08 11:34 tif7inDebugGDALInfo.exe
文件 5632 2014-05-08 11:34 tif7inDebugGDALMemDataset.exe
文件 6656 2014-05-08 11:34 tif7inDebugGDALOverviews.exe
文件 8704 2014-05-08 11:34 tif7inDebugGDALRead.exe
文件 8704 2014-05-08 11:34 tif7inDebugGDALReadDirect.exe
文件 5120 2014-05-08 11:34 tif7inDebugGDALWrite.exe
文件 1243648 2013-11-18 09:18 tif7inDebuggeos.dll
............此处省略123个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)