"GDAL" talk about GDAL data Model (ii)--band object

Source: Internet
Author: User
Tags scale image

The important object of the raster data directly participating in various computations in Gdal is band

Excerpt from the official description:

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 is represented as a dataset with three bands, one for Red, one for green D one for Blue.

The data in Gdal is based on a dataset, where the specific raster data values are stored in the band object of the DataSet, and a dataset can store multiple band objects. An image of an RGB color model, for example, is considered a dataset with 3 bands (corresponding to r\g\b respectively) in the Gdal data model.

A Raster Band has the following properties:

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

        this value in C # through Band.xsize, band.ysize get

    • 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 would be the one tile. For scanline oriented images this would normally be one scanline.

       

    • a list of Name/value pair metadata in the same format as the dataset, but of information. is PO Tentially specific to this band.

        is actually stored in the form of string[] (this is a custom practice for C + + programmers), guessing that Matadata is the same, and not comprehensive, metadata content obtained in the dataset.

    • An optional description string.

    • An optional single nodata pixel value (see also nodata_values metadata on the dataset for Multi-Band style NoData VALUES).

      NoData in C # is for band, in theory, if a dataset contains multiple band objects, the NoData values of these band objects are not guaranteed to be consistent. So we need to get them separately. It is also important to note that when creating a dataset to write data to, specifying NoData for its band needs to take into account the valid range of values and datatype of the data itself, setting the appropriate values.

    • 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.

      This value is used to obtain the maximum minimum statistic value for the data in the band, but it is recommended that you write your own method to handle the situation where the statistical values are occasionally incorrect under test.

  • 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 a HLS image
    • Gci_saturationband:this Raster is the saturation of a HLS image
    • Gci_lightnessband:this Raster is the hue of a 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.

In fact, in the real use, the more important is the data nodata, Xsize, ysize and so on, projection and other information obtained by the DataSet. It is not very easy to deal with the simple calculation in general case.

The next article will explain in detail a general flow of data reading and processing.

"GDAL" talk about GDAL data Model (ii)--band object

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.