位深轉換功能是一種用於更改一個給定輸入文件數據範圍的靈活方法。能夠徹底控制輸入和輸出直方圖,以及輸出數據類型(字節型、整型、浮點型等)。算法
PIE支持算法功能的執行,下面對位深轉換算法功能進行介紹。ide
第一步工具 |
算法參數設置測試 |
第二步編碼 |
算法執行spa |
第三步code |
結果顯示視頻 |
C#算法DLLblog |
PIE.CommonAlgo.dll教程 |
|
C#算法名稱 |
PIE.CommonAlgo.BitDepthTransAlgo |
|
參數結構體 |
DataBitDepthTrans_Exchange_Info |
|
參數說明 |
||
m_strInputFile |
String |
輸入柵格影像的路徑 |
m_strOutputFile |
String |
輸出影像的路徑 |
m_strMinIn |
Double |
輸入文件的像元最小值 |
m_strMaxIn |
Double |
輸入文件的像元最大值 |
m_strMinOu |
Double |
輸出文件的像元最小值 數據格式/最小值 "Byte";0 Int16";-32768 "UInt16";0 Int32";-2147483648 "UInt32";0 "Float32";0 "Float64";0 |
m_strMaxOu |
Double |
輸出文件的像元最大值 數據格式/最大值 "Byte"; 255.0 Int16";32768 "UInt16"; 65535.0 Int32";2147483648 "UInt32"; 4294967295.0 |
m_strOutDataType |
String |
輸出數據類型 "Byte";"Int16";"UInt16"; Int32";"UInt32";"Float32";"Float64"; |
m_strOutFileType |
String |
根據輸出類型得到文件編碼類型 .tif/.tiff——GTiff .img—————HFA 其餘—————ENVI |
項目路徑 |
百度雲盤地址下/PIE示例程序/ FundamentalToolDemo. BitDepthTransDemo |
數據路徑 |
百度雲盤地址下/ PIE示例數據/柵格數據/04.World/World.tif |
視頻路徑 |
百度雲盤地址下/PIE視頻教程10.算法調用/多功能工具/位深轉換算法.avi |
示例代碼 |
|
![]() 1 /// <summary> 2 ///位深轉換算法測試,本算法實現了將World.tif的數據類型轉換爲」Int16」生成World2.tif文件 3 /// </summary> 4 private void Test_KrigingInterpolationAlgo() 5 { 6 #region 一、參數設置 7 PIE.CommonAlgo.DataBitDepthTrans_Exchange_Info info = new PIE.CommonAlgo.DataBitDepthTrans_Exchange_Info(); 8 info.InputFile = @"D:\Data\World.tif"; 9 info.OutputFile = @"D:\Data\World2.tif"; 10 info.MaxIn = 255; 11 info.MinIn = 0; 12 info.MaxOut = 32768; 13 info.MinOut = -32768; 14 info.OutDataType = 1; 15 16 PIE.SystemAlgo.ISystemAlgo algo = PIE.SystemAlgo.AlgoFactory.Instance().CreateAlgo("PIE.CommonAlgo.dll", "PIE.CommonAlgo.BitDepthTransAlgo"); 17 if (algo == null) return; 18 #endregion 19 //二、算法執行 20 PIE.SystemAlgo.ISystemAlgoEvents algoEvents = algo as PIE.SystemAlgo.ISystemAlgoEvents; 21 algo.Name = "位深轉換"; 22 algo.Params = info; 23 PIE.SystemAlgo.AlgoFactory.Instance().ExecuteAlgo(algo); 24 //三、結果顯示 25 ILayer layer = PIE.Carto.LayerFactory.CreateDefaultLayer(@"D:\Data\World2.tif"); 26 m_HookHelper.ActiveView.FocusMap.AddLayer(layer); m_HookHelper.ActiveView.PartialRefresh(ViewDrawPhaseType.ViewAll); 27 } |