C# 利用IRawPixels接口遍歷柵格數(shù)據(jù)
更新時間:2017年02月10日 11:22:49 作者:杰桀
本文主要介紹了利用IRawPixels接口遍歷柵格數(shù)據(jù)。具有很好的參考價值,下面跟著小編一起來看下吧
AO的版本為10.2,開發(fā)的語言是C#。柵格數(shù)據(jù)來源IRasterDataset接口。
IRasterBandCollection pRasterBandCollection = pRasterDataset as IRasterBandCollection; IRasterBand pRasterBand = pRasterBandCollection.Item(0); IRaster pRaster = (pRasterDataset as IRasterDataset2).CreateFullRaster(); IRawPixels pRawPixels = pRasterBand as IRawPixels; IRasterProps pRasterProps = pRasterBand as IRasterProps; int dHeight = pRasterProps.Height; int dWidth = pRasterProps.Width; IPnt pntSize = new PntClass(); pntSize.SetCoords(dHeight, dWidth); IPnt pPixelBlockOrigin = new PntClass(); pPixelBlockOrigin.SetCoords(0, 0); IPixelBlock pixelBlock = pRaster.CreatePixelBlock(pntSize); pRawPixels.Read(pPixelBlockOrigin, pixelBlock); System.Array arr = (System.Array)(pixelBlock as IPixelBlock3).get_PixelData(0); for (int i = 0; i < dHeight;i++ ) { for (int j = 0; j < dWidth; j++) { float number = 0; float.TryParse(arr.GetValue(i,j).ToString(),out number); } }
以上就是本文的全部內(nèi)容,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作能帶來一定的幫助,同時也希望多多支持腳本之家!
相關(guān)文章
c#遍歷System.drawing.Color下面的所有顏色以及名稱以查看
c#遍歷System.drawing.Color下面的所有顏色以及名稱以查看,需要的朋友可以參考一下2013-02-02C#簡單讀取、改變文件的創(chuàng)建、修改及訪問時間的方法
這篇文章主要介紹了C#簡單讀取、改變文件的創(chuàng)建、修改及訪問時間的方法,涉及C#文件類SetCreationTime、SetLastWriteTime及SetLastAccessTime的相關(guān)使用技巧,需要的朋友可以參考下2015-07-07Unity中 ShaderGraph 實現(xiàn)超級炫酷的溶解效果入門級教程
這篇文章主要介紹了Unity中的 ShaderGraph 實現(xiàn)超級炫酷的溶解效果入門級教程,本文通過圖文并茂的形式給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2021-07-07C#更新文本框textbox數(shù)據(jù)同時刪除舊數(shù)據(jù)問題
這篇文章主要介紹了C#更新文本框textbox數(shù)據(jù)同時刪除舊數(shù)據(jù)問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-04-04