主要分析功能是採用相似卷積濾波的方法將較大類別中的虛假像元歸到該類中,首先定義一個變換核尺寸,而後用變換核中佔主要地位(像元最多)類別數代替中心像元的類別數,次要分析相反,用變換核中佔次要地位的像元的類別數代替中心像元的類別數。算法
PIE SDK支持算法功能的執行,下面對主/次要分析算法功能進行介紹。ide
第一步測試 |
算法參數設置spa |
第二步code |
算法執行視頻 |
第三步blog |
結果顯示教程 |
算法名稱索引 |
主/次要分析ip |
|
C#算法DLL |
PIE.CommonAlgo.dll |
|
C#算法名稱 |
PIE.CommonAlgo.ImgClassPostMMAAlgo |
|
參數結構體 |
StMajMinParameter |
|
參數說明 |
||
InputFileName |
String |
輸入分類文件 (*.tif;*.tiff; *.img) |
OutputFilePath |
String |
輸出分類主次要分析文件路徑 (*.tif;*.tiff; *.img) |
Veciselclass |
IList<Int> |
選中類別索引集合(正整數) |
VeciNotselclass |
IList<Int> |
未選中類別索引集合(正整數) |
MajMin |
Int |
分析方法類別(1表明次要,0表明主要) |
KernelX |
Int |
核大小X(大於等於3的奇數) |
KernelY |
Int |
核大小Y(大於等於3的奇數) |
Weight |
Int |
中心像元比重(大於等於1的正數) |
VecColor |
IList<Int> |
顏色列表 |
FuncName |
String |
功能名稱 |
項目路徑 |
百度雲盤地址下/PIE示例程序/10.算法調用/圖像處理/ImageProcessing. ImgClassPostMMAAlgo |
數據路徑 |
百度雲盤地址下/PIE示例數據/柵格數據/01.GF1/ISODataClassification.tif |
視頻路徑 |
百度雲盤地址下/PIE視頻教程/10.算法調用/圖像處理/主次要分析算法.avi |
示例代碼 |
|
![]() 1 /// <summary> 2 /// 主/次要分析算法測試,本算法實現了將ip_result1.tif進行主/次要分析,選擇的分類列表爲所有分類,形態學算子Rows和Columns均爲3 3 /// 4 /// </summary> 5 public override void OnClick() 6 { 7 #region 一、參數設置 8 PIE.CommonAlgo.StMajMinParameter info = new PIE.CommonAlgo.StMajMinParameter(); 9 10 info.InputFileName = @"D:\Data\ISODataClassification.tif"; 11 info.OutputFileName = @"D:\Data\ip_result6.tif"; 12 info.Veciselclass = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7,8 }; 13 info.VeciNotselclass = new List<int> { }; 14 info.MajMin = 1; 15 info.KernelX = 3; 16 info.KernelY = 3; 17 info.Weight=1; 18 info.VecColor = null; 19 20 PIE.SystemAlgo.ISystemAlgo algo = PIE.SystemAlgo.AlgoFactory.Instance().CreateAlgo("PIE.CommonAlgo.dll", "PIE.CommonAlgo.ImgClassPostMMAAlgo"); 21 if (algo == null) return; 22 #endregion 23 24 //二、算法執行 25 PIE.SystemAlgo.ISystemAlgoEvents algoEvents = algo as PIE.SystemAlgo.ISystemAlgoEvents; 26 algo.Name = " 主/次要分析"; 27 algo.Params = info; 28 bool result = PIE.SystemAlgo.AlgoFactory.Instance().ExecuteAlgo(algo); 29 30 //三、結果顯示 31 ILayer layer = PIE.Carto.LayerFactory.CreateDefaultLayer(@"D:\Data\ip_result6.tif"); 32 m_HookHelper.ActiveView.FocusMap.AddLayer(layer); 33 m_HookHelper.ActiveView.PartialRefresh(ViewDrawPhaseType.ViewAll); |