日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【GDAL】聊聊GDAL的数据模型(二)——Band对象

發布時間:2025/4/16 编程问答 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【GDAL】聊聊GDAL的数据模型(二)——Band对象 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在GDAL中柵格數據直接參與各種計算的重要對象是Band

摘錄官方描述:

Raster Band

A raster band is represented in GDAL with the GDALRasterBand class. It represents a single raster band/channel/layer. It does not necessarily represent a whole image. For instance, a 24bit RGB image would normally be represented as a dataset with three bands, one for red, one for green and one for blue.

Gdal 中數據以Dataset為基礎,具體的柵格數據值被存儲在這個Dataset的Band對象之中,一個Dataset可以存儲多個Band對象。例如RGB色彩模型的圖象,在GDAL的數據模型中被認為是一個擁有3個波段(分別對應R\G\B)的Dataset。

?

A raster band has the following properties:

  • A width and height in pixels and lines. This is the same as that defined for the dataset, if this is a full resolution band.

    ?該值在C#中通過Band.XSize, Band.YSize獲取

  • A datatype (GDALDataType). One of Byte, UInt16, Int16, UInt32, Int32, Float32, Float64, and the complex types CInt16, CInt32, CFloat32, and CFloat64.

    ?

  • A block size. This is a preferred (efficient) access chunk size. For tiled images this will be one tile. For scanline oriented images this will normally be one scanline.

    ?

  • A list of name/value pair metadata in the same format as the dataset, but of information that is potentially specific to this band.

    ?實際上是以String[]方式存儲的(這是C/C++程序員的習慣做法),猜測該matadata即是Dataset中獲取的metadata內容一致,且不全面。

  • An optional description string.

    ?

  • An optional single nodata pixel value (see also NODATA_VALUES metadata on the dataset for multi-band style nodata values).

    在C#中Nodata是對band而言的,理論上如果一個Dataset包含多個Band對象,這些Band對象的Nodata值是不能保證一致的。所以需要分別獲取。另外需要注意的一點是,在創建要寫入數據的Dataset時,為其Band指定Nodata需要考慮這個數據本身的有效值范圍和DataType,設置合適的值。?

?

  • An optional nodata mask band marking pixels as nodata or in some cases transparency as discussed in RFC 15: Band Masks.

    ?

  • An optional list of category names (effectively class names in a thematic image).

    ?

  • An optional minimum and maximum value.

    ?該值用于獲取Band中數據的最大最小統計值,不過測試了下偶爾會出現統計值不正確的情況,建議自己寫方法來處理。

  • An optional offset and scale for transforming raster values into meaning full values (i.e. translate height to meters).

    ?

  • An optional raster unit name. For instance, this might indicate linear units for elevation data.

    ?

  • A color interpretation for the band. This is one of:

    • GCI_Undefined: the default, nothing is known.
    • GCI_GrayIndex: this is an independent gray-scale image
    • GCI_PaletteIndex: this raster acts as an index into a color table
    • GCI_RedBand: this raster is the red portion of an RGB or RGBA image
    • GCI_GreenBand: this raster is the green portion of an RGB or RGBA image
    • GCI_BlueBand: this raster is the blue portion of an RGB or RGBA image
    • GCI_AlphaBand: this raster is the alpha portion of an RGBA image
    • GCI_HueBand: this raster is the hue of an HLS image
    • GCI_SaturationBand: this raster is the saturation of an HLS image
    • GCI_LightnessBand: this raster is the hue of an HLS image
    • GCI_CyanBand: this band is the cyan portion of a CMY or CMYK image
    • GCI_MagentaBand: this band is the magenta portion of a CMY or CMYK image
    • GCI_YellowBand: this band is the yellow portion of a CMY or CMYK image
    • GCI_BlackBand: this band is the black portion of a CMYK image.

    ?

  • A color table, described in more detail later.

    ?

  • Knowledge of reduced resolution overviews (pyramids) if available.

其實在真正使用中,比較重要的無非是數據的nodata、xSize、ySize等等,投影等信息由Dataset獲取。用于應付一般情況下的簡單計算問題不大。

下一篇將詳細解釋一個常規的數據讀取和處理的流程。

轉載于:https://www.cnblogs.com/DannielZhang/p/5183761.html

總結

以上是生活随笔為你收集整理的【GDAL】聊聊GDAL的数据模型(二)——Band对象的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。