过滤功能使用斑点分组方法来消除分类文件中被隔离的分类像元,用以解决分类图像中出现的孤岛问题。算法
PIE SDK支持算法功能的执行,下面对过滤算法功能进行介绍。ide
2.1. 实现步骤测试
第一步spa |
算法参数设置3d |
第二步code |
算法执行视频 |
第三步blog |
结果显示教程 |
2.2. 算法参数ip
算法名称 |
过滤 |
|
C#算法DLL |
PIE.CommonAlgo.dll |
|
C#算法名称 |
PIE.CommonAlgo.ImgClassPostSieveAlgo |
|
参数结构体 |
StClassPostclump |
|
参数说明 |
||
inputfile |
String |
输入分类后的影像路径 *.tif;*.tiff;*.img |
outputfile |
String |
输出影像路径 |
classindex |
IList<Int> |
选择的分类列表 |
kernel |
IList<Int> |
本算法中该参数一共须要两个变量 第一个值表示聚类邻域大小值为4或8;表示参与分析的周围像元大小 第二个值表示过滤阈值 (值大于1)一组中小于该值的像元将被删除 |
项目路径 |
百度云盘地址下/PIE示例程序/10.算法调用/图像处理/ ImageProcessing. ImgClassPostSieveAlgo |
数据路径 |
百度云盘地址下/PIE示例数据/栅格数据/01.GF1/ISODataClassification.tif |
视频路径 |
百度云盘地址下/PIE视频教程/10.算法调用/图像处理/过滤算法avi |
示例代码 |
|
![]() 1 /// <summary> 2 /// 过滤算法测试,本算法实现了将ip_result1.tif进行过滤,选择的分类列表为所有分类,聚类邻域为4,过滤阈值为2 3 /// </summary> 4 public override void OnClick() 5 { 6 #region 一、参数设置 7 PIE.CommonAlgo.StClassPostclump info = new PIE.CommonAlgo.StClassPostclump(); 8 9 info.inputfile = @"D:\Data\ISODataClassification.tif"; 10 info.outputfile = @"D:\Data\ip_result4.tif"; 11 info.classindex = new List<int> { 0, 1, 2, 3,4,5,6,7,8 }; 12 info.kernel = new List<int> { 4, 2 }; 13 14 PIE.SystemAlgo.ISystemAlgo algo = PIE.SystemAlgo.AlgoFactory.Instance().CreateAlgo("PIE.CommonAlgo.dll", "PIE.CommonAlgo.ImgClassPostSieveAlgo"); 15 if (algo == null) return; 16 #endregion 17 18 //二、算法执行 19 PIE.SystemAlgo.ISystemAlgoEvents algoEvents = algo as PIE.SystemAlgo.ISystemAlgoEvents; 20 algo.Name = " 过滤"; 21 algo.Params = info; 22 bool result = PIE.SystemAlgo.AlgoFactory.Instance().ExecuteAlgo(algo); 23 24 //三、结果显示 25 ILayer layer = PIE.Carto.LayerFactory.CreateDefaultLayer(@"D:\Data\ip_result4.tif"); 26 m_HookHelper.ActiveView.FocusMap.AddLayer(layer); 27 m_HookHelper.ActiveView.PartialRefresh(ViewDrawPhaseType.ViewAll); 28 } |