PIE SDK柵格矢量化算法

1.算法功能簡介

  柵格數據矢量化較爲複雜,若是由一幅掃描的數字化地圖來創建矢量數據庫,則須要通過數字圖象處理,如邊緣加強、細化、二值化、特徵提取及模式識別才能得到矢量數據.人們一般將多色地圖分色後逐個元素(如等高線地貌、水系、道路網、地物、符號與註記等)加以識別和提取.若是將數字影像矢量化,則須要事先作好重採樣、圖象處理、影像匹配和影像理解等過程,才能將影像上的語義和非語義信息提取出來,並造成矢量形式的數據算法

  PIE支持柵格矢量化算法功能的執行,下面對該算法功能進行介紹。數據庫

2.算法功能實現說明

2.1 實現步驟

第一步ide

算法參數設置spa

第二步code

算法執行orm

第三步blog

結果顯示索引

2.2 算法參數

算法名稱ci

柵格矢量化string

C#算法DLL

PIE.CommonAlgo.dll

C#算法名稱

PIE.CommonAlgo.RasterToVectorAlgo

參數結構體

RasterVectorization_Exchange_Info

參數說明

pchrasterIndexImgPath

String

索引圖路徑、即輸入的影像路徑

indexList

IList<Int>

類別列表

pixList

IList<Int>

類別對應像素列表

indexNameList

IList<String>

類別名稱列表

savingPathList

IList<String>

保存路徑列表

vpixTable

IList<Int>

像素值索引表,一般默認爲0 參數能夠不設置

isSaveAsOneFile

bool

是否保存單個文件標誌

isCountPolygonInfo

bool

是否計算面信息

isNoGeoTransform

bool

是否進行地理座標轉化

m_strOutFile

String

輸出矢量數據

 

2.3 示例代碼

數據路徑

百度雲盤地址下/ PIE示例數據/柵格數據/ 08.圖像分類/distanceClassify-Julei.tif

示例代碼

 1 /// <summary>
 2 /// 柵格矢量化  對分類後的影像distanceClassify-Julei.tif進行矢量化,該類共有5類;
 3 /// </summary>
 4 public void RasterToVector()
 5 {
 6     RasterVectorization_Exchange_Info info = new RasterVectorization_Exchange_Info();
 7     info.indexList = new List<int> {0,1,2,3,4};//類別列表
 8     info.indexNameList = new List<string> {"Unclassified","water","veg","bare","town" };//類別名稱列表
 9     info.isCountPolygonInfo = false;
10     info.isSaveAsOneFile = true;//是否保存單個文件 fasle 保存多個文件
11     info.pchrasterIndexImgPath = @"D:\data\圖像分類2\distanceClassify-Julei.tif";//輸入的柵格路徑
12     info.pixList = new List<int> { 0, 1, 2, 3, 4 };//類別對應像素列表 和類別列表對應
13     info.savingPathList = new List<string> {@"D:\data\圖像分類2\distanceClassify-Julei_Re.shp" };//保存路徑列表:若保存單個文件,一個輸出路徑便可,若輸出多個文件,輸出路徑即爲每一類生成文件路徑
14     //info.vpixTable = new List<int>(); ;//像素值索引表, 能夠設置這個參數,默認是0
15 
16     PIE.SystemAlgo.ISystemAlgo algo = PIE.SystemAlgo.AlgoFactory.Instance().CreateAlgo("PIE.CommonAlgo.dll", "PIE.CommonAlgo.RasterToVectorAlgo");
17     if (algo == null) return;
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     if (result)
24     {
25         MessageBox.Show("柵格矢量化算法執行成功");
26         IList<ILayer> listLayer = LayerFactory.CreateDefaultLayers(info.savingPathList);           
27         if (listLayer == null) return;
28         m_HookHelper.ActiveView.FocusMap.AddLayers(listLayer);
29         m_HookHelper.ActiveView.PartialRefresh(ViewDrawPhaseType.ViewAll);
30     }
31 }
View Code

2.4 示例截圖

 

圖1:算法執行結果圖

 

圖2:將圖1進行惟一值渲染

相關文章
相關標籤/搜索