资源简介

用C# 基于GDAL写的遥感影像读取及显示程序

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OSGeo.GDAL;

namespace ImageDisplay
{
    public class DisplaySetting
    {
        int ixSize = 0;
        int iySize = 0;
        string imageFilePath;
        Dataset dataSet;
        int nBand = 1;
        bool GreyFlag = false;

        public DisplaySetting(string imageName)
        {
            imageFilePath = imageName;
        }

        public void GetImageInfo() //InitialTreeView
        {
            Gdal.AllRegister();
            dataSet = Gdal.OpenShared(imageFilePath Access.GA_ReadOnly);
            ixSize = dataSet.RasterXSize;
            iySize = dataSet.RasterYSize;
            int bandCount = dataSet.RasterCount;

            if (bandCount == 1)
            {
                GreyFlag = true;
            }
        }

        public void LoadingImage() //btnApply_Click
        {
            int w = ixSize;
            int y = iySize;

            short[] dataRed dataGreen dataBlue;
            byte[] arrayRed arrayGreen arrayBlue;

            if (GreyFlag)
            {
                Universal.TheBandBlue = Universal.TheBandGreen = Universal.TheBandRed = dataSet.GetRasterBand(nBand);
                arrayBlue = arrayGreen = arrayRed = RasterHandle.GetBandArray(Universal.TheBandRed out dataRed);
                dataGreen = dataBlue = dataRed; ;
            }
            else 
            {
                //select bands
                Universal.TheBandRed = dataSet.GetRasterBand(nBand);
                Universal.TheBandGreen = dataSet.GetRasterBand(nBand + 1);
                Universal.TheBandBlue = dataSet.GetRasterBand(nBand + 2);
                //read image
                arrayRed = RasterHandle.GetBandArray(Universal.TheBandRed out dataRed);
                arrayGreen = RasterHandle.GetBandArray(Universal.TheBandGreen out dataGreen);
                arrayBlue = RasterHandle.GetBandArray(Universal.TheBandBlue out dataBlue);
            }

            Universal.SetBitmapParameters(w y arrayRed arrayGreen arrayBlue dataRed dataGreen dataBlue);
        }


    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件    5132288  2010-10-08 20:17  ImageDisplay\ImageDisplay\bin\Debug\gdal16.dll

     文件      81920  2010-11-03 10:36  ImageDisplay\ImageDisplay\bin\Debug\gdal_csharp.dll

     文件      68096  2010-11-03 10:36  ImageDisplay\ImageDisplay\bin\Debug\gdal_wrap.dll

     文件      27136  2011-09-29 22:07  ImageDisplay\ImageDisplay\bin\Debug\ImageDisplay.exe

     文件      40448  2011-09-29 22:07  ImageDisplay\ImageDisplay\bin\Debug\ImageDisplay.pdb

     文件      14328  2011-10-13 22:29  ImageDisplay\ImageDisplay\bin\Debug\ImageDisplay.vshost.exe

     文件        490  2009-06-11 05:14  ImageDisplay\ImageDisplay\bin\Debug\ImageDisplay.vshost.exe.manifest

     文件       2203  2011-09-28 22:09  ImageDisplay\ImageDisplay\DisplaySetting.cs

     文件       5978  2011-09-29 22:07  ImageDisplay\ImageDisplay\Form1.cs

     文件      10847  2011-09-29 22:07  ImageDisplay\ImageDisplay\Form1.Designer.cs

     文件      20614  2011-09-29 22:07  ImageDisplay\ImageDisplay\Form1.resx

     文件       4041  2011-09-27 16:40  ImageDisplay\ImageDisplay\ImageDisplay.csproj

     文件        951  2011-10-13 22:29  ImageDisplay\ImageDisplay\obj\Debug\ImageDisplay.csproj.FileListAbsolute.txt

     文件        847  2011-09-29 22:07  ImageDisplay\ImageDisplay\obj\Debug\ImageDisplay.csproj.GenerateResource.Cache

     文件      27136  2011-09-29 22:07  ImageDisplay\ImageDisplay\obj\Debug\ImageDisplay.exe

     文件      10228  2011-09-29 22:07  ImageDisplay\ImageDisplay\obj\Debug\ImageDisplay.Form1.resources

     文件      40448  2011-09-29 22:07  ImageDisplay\ImageDisplay\obj\Debug\ImageDisplay.pdb

     文件        180  2011-09-28 12:38  ImageDisplay\ImageDisplay\obj\Debug\ImageDisplay.Properties.Resources.resources

     文件       3385  2011-09-28 12:38  ImageDisplay\ImageDisplay\obj\Debug\ResolveAssemblyReference.cache

     文件        504  2011-09-26 14:00  ImageDisplay\ImageDisplay\Program.cs

     文件       1436  2011-09-26 14:00  ImageDisplay\ImageDisplay\Properties\AssemblyInfo.cs

     文件       2853  2011-09-26 14:00  ImageDisplay\ImageDisplay\Properties\Resources.Designer.cs

     文件       5612  2011-09-26 14:00  ImageDisplay\ImageDisplay\Properties\Resources.resx

     文件       1097  2011-09-26 14:00  ImageDisplay\ImageDisplay\Properties\Settings.Designer.cs

     文件        249  2011-09-26 14:00  ImageDisplay\ImageDisplay\Properties\Settings.settings

     文件       1686  2011-09-28 17:18  ImageDisplay\ImageDisplay\RasterHandle.cs

     文件       4101  2011-09-29 15:12  ImageDisplay\ImageDisplay\Universal.cs

     文件        926  2011-09-26 14:00  ImageDisplay\ImageDisplay.sln

    ..A..H.     23552  2011-10-13 22:29  ImageDisplay\ImageDisplay.suo

     文件     500000  2011-08-08 02:21  ImageDisplay\starFM_dat_data\etm_simulate1

............此处省略41个文件信息

评论

共有 条评论