PIE SDK聚类

1.算法功能简介

    聚类处理时运用形态学算子将临近的类似分类区域聚类并合并。

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

2.算法功能实现说明

2.1. 实现步骤

第一步

算法参数设置

第二步

算法执行

第三步

结果显示

2.2. 算法参数

算法名称

聚类

C#算法DLL

PIE.CommonAlgo.dll

C#算法名称

PIE.CommonAlgo.ImgClassPostClumpAlgo

参数结构体

StClassPostclump

参数说明

inputfile

String

输入分类后的影像路径

*.tif;*.tiff;*.img

outputfile

String

输出影像路径

classindex

IList<Int>

选择的分类列表

kernel

IList<Int>

本算法中该参数含义为形态学算子,一共需要两个变量

第一个值表示形态学算子Rows大小值为奇数

第二个值表示形态学算子Columns大小值为奇数

2.3. 示例代码

项目路径

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

数据路径

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

视频路径

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

示例代码

 1 /// <summary>
 2 /// 聚类算法测试,本算法实现了将ip_result1.tif进行聚类,选择的分类列表为全部分类,形态学算子Rows和Columns均为3
 3 /// </summary>
 4 public override void OnClick()
 5 {
 6 #region 1、参数设置
 7 PIE.CommonAlgo.StClassPostclump info = new PIE.CommonAlgo.StClassPostclump();
 8 
 9 info.inputfile = @"D:DataISODataClassification.tif";
10 info.outputfile = @"D:Dataip_result5.tif";
11 info.classindex = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
12 info.kernel = new List<int> { 3,3 };
13 
14 PIE.SystemAlgo.ISystemAlgo algo = PIE.SystemAlgo.AlgoFactory.Instance().CreateAlgo("PIE.CommonAlgo.dll", "PIE.CommonAlgo.ImgClassPostClumpAlgo");
15 if (algo == null) return;
16 #endregion
17 
18 //2、算法执行
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 //3、结果显示
25 ILayer layer = PIE.Carto.LayerFactory.CreateDefaultLayer(@"D:Dataip_result5.tif");
26 m_HookHelper.ActiveView.FocusMap.AddLayer(layer);
27 m_HookHelper.ActiveView.PartialRefresh(ViewDrawPhaseType.ViewAll);
28 }
View Code

2.4. 示例截图

原文地址:https://www.cnblogs.com/PIESat/p/10215019.html