PIE SDK过滤

时间:2023-03-09 14:37:40
PIE SDK过滤

1. 算法功能简介

过滤功能使用斑点分组方法来消除分类文件中被隔离的分类像元,用以解决分类图像中出现的孤岛问题。

PIE SDK支持算法功能的执行,下面对过滤算法功能进行介绍。

2. 算法功能实现说明

2.1. 实现步骤

第一步

算法参数设置

第二步

算法执行

第三步

结果显示

2.2. 算法参数

算法名称

过滤

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)一组中小于该值的像元将被删除

2.3. 示例代码

项目路径

百度云盘地址下/PIE示例程序/10.算法调用/图像处理/ ImageProcessing. ImgClassPostSieveAlgo

数据路径

百度云盘地址下/PIE示例数据/栅格数据/01.GF1/ISODataClassification.tif

视频路径

百度云盘地址下/PIE视频教程/10.算法调用/图像处理/过滤算法avi

示例代码

 /// <summary>
/// 过滤算法测试,本算法实现了将ip_result1.tif进行过滤,选择的分类列表为全部分类,聚类邻域为4,过滤阈值为2
/// </summary>
public override void OnClick()
{
#region 1、参数设置
PIE.CommonAlgo.StClassPostclump info = new PIE.CommonAlgo.StClassPostclump(); info.inputfile = @"D:\Data\ISODataClassification.tif";
info.outputfile = @"D:\Data\ip_result4.tif";
info.classindex = new List<int> { , , , ,,,,, };
info.kernel = new List<int> { , }; PIE.SystemAlgo.ISystemAlgo algo = PIE.SystemAlgo.AlgoFactory.Instance().CreateAlgo("PIE.CommonAlgo.dll", "PIE.CommonAlgo.ImgClassPostSieveAlgo");
if (algo == null) return;
#endregion //2、算法执行
PIE.SystemAlgo.ISystemAlgoEvents algoEvents = algo as PIE.SystemAlgo.ISystemAlgoEvents;
algo.Name = " 过滤";
algo.Params = info;
bool result = PIE.SystemAlgo.AlgoFactory.Instance().ExecuteAlgo(algo); //3、结果显示
ILayer layer = PIE.Carto.LayerFactory.CreateDefaultLayer(@"D:\Data\ip_result4.tif");
m_HookHelper.ActiveView.FocusMap.AddLayer(layer);
m_HookHelper.ActiveView.PartialRefresh(ViewDrawPhaseType.ViewAll);
}

2.4. 示例截图

PIE SDK过滤