PIE SDK波段合成

 

1.算法功能简介

    波段合成功能主要用于将多幅图像合并为一个新的多波段图像(即波段的叠加打包,构建一个新的多波段文件),从而可根据不同的用途选择不同波长范围内的波段合成 RGB 彩色图像。

    PIE支持算法功能的执行,下面对波段合成算法功能进行介绍。

2.算法功能实现说明

2.1 实现步骤

第一步

算法参数设置

第二步

算法执行

第三步

结果显示

2.2 算法参数

C#算法DLL

PIE.CommonAlgo.dll

C#算法名称

PIE.CommonAlgo.BandCombinationAlgo

参数结构体

BandCombination_Exchange_Info

参数说明

m_vecFileptr

IIList< IRasterDataset>

输入影像的数据集

获取输入栅格影像的RasterDataset

bands

IIList<IList<int>>

输入每个波段需要合并的波段列表

tstrfile

String

输出文件路径

m_strFileTypeCode

String

根据输出类型获得文件编码类型

.tif/.tiff——GTiff

.img—————HFA

其他—————ENVI

regioninfo

IList<Interestregion>

输入影像的范围集合

m_iOutRangeCrossType

Int

输出范围方式方式,0-交集,1-并集

 

Interestregion (输入影像范围)

ULx

Int

左上角的列坐标(从0开始)

ULy

Int

左上角的行坐标(从0开始)

height

Int

输入的行数

Width

Int

输入的列数

2.3示例代码

项目路径

百度云盘地址下/PIE示例程序/ FundamentalToolDemo.BandCombinationDemo

数据路径

百度云盘地址下/ PIE示例数据/栅格数/World/world.tiff

视频路径

百度云盘地址下/PIE视频教程/波段合成算法avi

示例代码

 1          /// <summary>
 2         ///波段合成算法测试,本算法实现了将两幅World.tif影像的1-3波段合并为具有6个波段的World5.tif影像
 3         /// </summary>
 4         private void Test_KrigingInterpolationAlgo()
 5         {
 6             #region 1、参数设置
 7             PIE.CommonAlgo.BandCombination_Exchange_Info info = new PIE.CommonAlgo.BandCombination_Exchange_Info();
 8             string path = @"D:\Data\World.tif";
 9             IRasterDataset rDataset = DatasetFactory.OpenDataset(path, OpenMode.ReadOnly) as IRasterDataset;
10 
11             info.m_vecFileptr = new List<IRasterDataset> { rDataset, rDataset };
12             List<int> list1 = new List<int> { 0,1,2 };
13             info.bands = new List<List<int>> { list1,list1 };
14             info.tstrfile = @"D:\Data\World5.tif";
15             info.m_strFileTypeCode = "GTiff";
16             PIE.CommonAlgo.Interestregion interestregion = new PIE.CommonAlgo.Interestregion();
17             interestregion.SetRegion(0, 0, rDataset.GetRasterYSize(), rDataset.GetRasterXSize());
18             info.regioninfo = new List<PIE.CommonAlgo.Interestregion> { interestregion, interestregion };
19             info.m_iOutRangeCrossType = 0;
20 
21             PIE.SystemAlgo.ISystemAlgo algo = PIE.SystemAlgo.AlgoFactory.Instance().CreateAlgo("PIE.CommonAlgo.dll", "PIE.CommonAlgo.BandCombinationAlgo");
22             if (algo == null) return;            
23 #endregion
24 
25             //2、算法执行
26             PIE.SystemAlgo.ISystemAlgoEvents algoEvents = algo as PIE.SystemAlgo.ISystemAlgoEvents;
27             algo.Name = "波段合成";
28             algo.Params = info;
29             bool result = PIE.SystemAlgo.AlgoFactory.Instance().ExecuteAlgo(algo);        
30             //3、结果显示
31 ILayer layer = PIE.Carto.LayerFactory.CreateDefaultLayer(@"D:\Data\World5.tif");
32             m_HookHelper.ActiveView.FocusMap.AddLayer(layer);           m_HookHelper.ActiveView.PartialRefresh(ViewDrawPhaseType.ViewAll);                     
33                     }
View Code

2.4示例截图

猜你喜欢

转载自www.cnblogs.com/PIESat/p/10157259.html