Imagery Basics

Donal Mateer
Donal Mateer
  • Updated

Introduction

Imagery is any type of photograph captured by electronic devices such as satellites, aircraft, cameras, and mobile phones. It can be printed on film or stored digitally. Images are commonly composed of a rectangular matrix of evenly-spaced cells (commonly referred to as pixels) arranged in columns and rows. This description also describes the term Raster.

Imagery and Rasters have different concepts. As highlighted previously, imagery is a type of data, such as photographs. Rasters are used in imagery as photographs are commonly made up of pixels arranged in columns and rows.

This article is a general guide on imagery. It will include:

  • Terms used in Imagery
  • Its concepts
  • And how they can be used in FME

 

Terminology

Main Terminology

This table highlights different terms used commonly in imagery, along with concepts and examples:

Term Description Concept
Raster Dataset A raster dataset is a grid of data organized into rows and columns. Each data value, a location at the intersection of each row and column, is known as a pixel or cell.
Image Dataset An image dataset contains data values for each cell representing a color or degree of shading.
Numeric Dataset A numeric dataset represents spatial data that contains measured values (e.g., DEM).
Band A raster dataset can contain a number of different “layers” known as bands. Another way of looking at this is to say each cell can consist of a number of values (i.e., Image datasets). See: Understanding Bands
Palette

A palette is a lookup table of discrete keys composed of color or string values - a means to map the value of a raster cell to a particular color or alphanumeric value.

See: Raster Documentation
Interleaving Interleaving is a technique that specifies how data is organized within a multi-band raster dataset (e.g., RGBA). See: Raster Documentation
Raster Origins and Extents

For an entire raster dataset, the origin point is the upper left corner. The extents of a raster are the lower left X and Y of the lower left cell to the upper right X and Y of the upper right cell.

See: Raster Origins and Extents
Raster Data Type Refers to the method by which values are stored within a raster dataset. It can be used as an integer or real number (i.e., -4 or 43.2122222).
Raster Interpretation Indicates how a raster data type should be interpreted. For example, is it a numeric, grayscale, or color value within a multi-band dataset? See: Understanding Interpretation
Resampling Refers to a process that changes raster resolution. A new grid of cells is generated and overlaid on the original dataset, with cell values for the new grid taken from the existing cells. See: Understanding Resampling
Pyramiding Pyramids are lower-resolution views of a dataset. When writing a raster dataset, several pyramids can be created at various lower resolutions to replace the original raster when only a snapshot or overview of the data is required. See: Understanding Pyramiding
Tiling Tiling is when source data is divided into any number of square or rectangular outputs based on a specific user-defined tile size. See: Understanding Tiling
 

 

Other Terminology

Term Description Example
File-Based Raster Datasets Stores the complete dataset within a single file. It can range from a simple single-band GeoTIFF to a multi-band, multi-resolution HDF4 dataset. See: Raster Documentation
Folder-Based Raster Datasets Stores the complete dataset within a single folder.

Satellite formats such as RADARSAT -2 product format or IKONOS standard products where the

individual bands of data are stored as separate GeoTIFF files and read as separate features.

Features With raster data, an entire dataset is a single feature, which makes it easier to handle multiple raster datasets. Conversely, a raster feature is not the smallest unit of data and is made up of smaller units such as bands, palettes, and cells.
File Naming Conventions How a file is named. (i.e., JPEG01.jpg). See: Raster Documentation
 

 

Concepts

Understanding Bands

Bands can be considered as the layers in a raster dataset. Alternatively, think of each cell as having a number of values (like an FME list attribute).

For example, a color raster dataset commonly has three bands: Red, Green, and Blue. There are Red, Green, and Blue layers, or each cell has a value for each band.

 

Band Terminology

In FME, bands are numbered from 0 onwards (just like in the previous image). A single-band raster has one band (0), whereas an RGB color raster has multiple bands (0, 1, 2).

An understanding of bands may be required, for example, to do each of the following tasks:

  • Translate a raster dataset from one format to another
  • Overlay vector data into raster
  • Resample a raster’s resolution
  • Mosaic raster datasets together
  • Use transparency and compositing
  • Carry out raster algebra on cells (pixels)

 

Band Management in FME

FME Workbench includes transformers to manipulate bands from a raster feature (data). Some processes might include adding and/or removing bands - the RasterBandAdder and RasterBandRemover transformers accomplish these. See the Common Imagery Tasks article for a simple example.

Changing the number of bands usually involves changing the interpretation of a feature (e.g., from color to numeric), for which a set of specialized transformers handles the bands automatically (this is discussed further in the Understanding Interpretation section).

More information on bands can be found in the Raster Documentation.

 

Raster Origins and Extents

The origin point for an entire raster dataset (see image) is the upper left corner (A).

The extents of a raster are the lower left X and Y of the lower left cell to the upper right X and Y of the upper right cell (B).

For individual cells, 0.0, 0.0 is the lower left corner, and 1.0, 1.0 is the upper right corner. The origin point is usually the cell center: 0.5, 0.5 (C). This is the cell origin that FME uses.

12e82e47-0af4-4028-b34b-41d4c192b08f

 

Understanding Interpretation

Interpretation describes the type of data stored at each cell in a raster and the number of bits used for that type of band. Like bands, interpretation is another concept to be familiar with to fully utilize FME’s raster functionality.

An understanding of interpretation may be required, for example, to do each of the following tasks:

  • Translate a raster dataset from one format to another
  • Mosaic raster datasets together
  • Carry out raster algebra on cells (pixels)
  • Compress data to minimize file size

In general, the properties that define a cell value are:

  • Data type
  • Bit depth
  • Data interpretation

Data Type and Bit Depth are key components of raster interpretation.

 

Data Type

Data Type classifies the nature of data values. The following are data types:

  • Unsigned Integer (positive values only)
  • Signed Integer (negative and positive values)
  • Real number (floating point)
  • String (alphanumeric)

 

Bit Depth

Bit-depth refers to the number of bits used to store values; this affects the range of numbers and the length of string that can be stored.

Together, Data Type and Bit Depth define what values can be stored in a raster cell.

For example (see image), a value could be stored as an 8-bit unsigned integer UInt8.

In binary, that is 28 = 256. This means there are 256 possible values. Including zero this gives us a range of values from 0 to 255.

An 8-bit signed integer (Int8) would give us 256 values from -127 to +128.

UInt16 would give us values from 0 to 65536 (-32767 to 32768 for a 16-bit signed integer).

 

Data Interpretation

Interpretation is used to denote what exactly Data Type and Bit Depth values mean.

For example, the Data Type UInt8 can be used for any one of the following:

  • A simple band of numeric values.
  • A range of shades on a grayscale image.
  • A color band in an RGB image.
  • A set of transparency values in an image.
  • A simple band of alphanumeric values.

Actual use in any given dataset is denoted by the Data Interpretation:

Use

Numeric Values

Grayscale shade

Color band in RGB

Transparency Values

Alphanumeric Values

Interpretation

UInt8

Gray8

Red8, Green8, or Blue8

Alpha8

String

 

Importance

In general, the properties of a raster dataset are important because it is a restriction on the quality and precision of the data. The more bits of data stored, the more information can be held, but at the cost of larger datasets.

For example:

  • A 16-bit color image will have a wider range of different shades (65536 colors) than an 8-bit color image (256 colors).
  • A 64-bit real number will be able to store values with greater precision and a higher maximum value than a 32-bit integer.
  • A signed integer will be able to store negative numbers.

However, these issues are related to data quality itself. FME is also concerned about being able to translate data and transform it, and this has its own set of issues.

 

Interpretation Incompatibility

One issue that arises is that not all raster formats support all data types. If a user is unaware of the concept they might try to translate data to a format that does not support that particular interpretation and data type (See FME Data Types for different data types).

For example, a user is unable to write a raster DEM represented by a numeric value (say INT32) to an image format such as JPEG (see image).

This can be particularly confusing to a user because when they open the DEM in a raster viewer, it has a range of colors. In fact the color is being generated by the inspection tool and is not part of the data itself.

6a1a798f-c41d-4e8e-8a4a-7d0f56704862

The solution is to manipulate the data type and interpretation of the data. However, because data type is so integral to the quality of a dataset, and there are different ways of making the adjustment, FME will not do this automatically.

Instead, FME will log an error and stop the translation. It would be necessary to determine the correct interpretation and convert the data with a transformer. This is why it is important to be aware of this concept.

 

Reducing Bit Depth

Higher bit-depth datasets are larger. They take up more space and consume more system resources to work with.

Therefore, you may wish to trade off some of this size against having smaller and more efficient datasets. This is particularly true when the data is to be distributed via a network or the web.

By reducing bit depth, data is being compressed into a smaller range of values.

For example, take a raster dataset stored as UInt16 (a 16-bit unsigned integer). This allows cell values between 0 and 65535. A user decides that they don’t require such a large range of values and uses FME to convert the data to UInt8 with a range of 0 to 256.

However, in doing so, FME compresses the values from the higher range to fit them into a lower range, which causes a noticeable reduction in data precision.

This is because different values from the 16-bit dataset will end up squashed into the same value in the new 8-bit dataset. So, this technique should only be used where the output doesn’t require the full color or tone range provided by the higher bit depth.

Note that, in order to preserve as much precision as possible, FME will only compress data where values exist.

Here (see image), the values 12000 to 44000 are compressed into a range of 0 to 256.

In this way, if the starting values were actually between 10,000 and 10,256, then it would be possible to reduce bit depth without any loss of precision, just a saving in file size.

0e354afa-eb03-4895-8d88-60496e4b1645

However, reducing bit depth is problematic when a raster dataset uses zero to denote a cell where no data exists. Then, FME wouldn’t know what the real range of data was. Such values could cause an unnecessary loss of precision or end up being merged with true data values.

See the Image Compression in FME article for a more thorough explanation with examples.

 

Increasing Bit Depth

Increasing the bit-depth of a dataset is possible by stretching the existing range of values across a larger range of numbers.

For example, take a raster dataset stored as UInt8 (an 8-bit unsigned integer). A user decides to convert the data to UInt16. FME will expand the data to fit the higher range.

However, when expanding values to a higher range, it can’t really describe the data in a more precise way despite the increase in bit-depth. That’s because multiple values from the source are grouped together on the destination.

For example, an 8-bit color image expanded to 16-bit still only has a maximum of 256 different color values; they are just now spread over a wider range with gaps between them.

The only reason to do an increase in precision like this is when further operations are to be carried out that require a larger bit-depth.

 

Interpreting Data in FME

Raster interpretation in FME is carried out by various transformers, depending on the use case.

 

Raster Algebra

Raster algebra is a set of techniques that carry out calculations and processing on individual cells. There are a variety of raster algebra processes available in FME, including:

  • Offsetting raster values (i.e., adding a fixed amount to each cell value)
  • Scaling raster values (i.e., multiplying each cell value by a fixed amount)
  • Evaluating values based on multiple raster features (see image)

There are multiple uses for raster algebra, too, including:

  • Converting units (for example, from feet to meters).
  • Summing a series of values recorded over time (for example, rainfall). 
  • Best location analyses (including weighting of different factors) (see image).

 

Offsetting

Offsetting data simply means moving features by a certain specified distance along the X or Y axis on a cartesian plane (see image). 


However, with a raster dataset, an offset on the Z axis will cause the offset value to be added to the value stored in each cell.

8c857d03-31ad-4c38-a1b9-ce9407bd1504

40b7cb9d-7902-4bfc-87ca-b58c8ecdf7e4

Here (see image), a raster feature is offset by Four units on the Z axis.

Note how the output values are all increased by 4.

Offsetting in FME Workbench is carried out using the Offsetter transformer. The offset value refers to whatever working units are used in the dataset.

 

Scaling

Scaling is usually the act of multiplying each coordinate value by a specified factor, in effect causing a proportional increase or decrease in the size of each feature (see image).

With a raster dataset, a Z scale factor will cause the values stored in each cell to be scaled by the specified proportion.

Here (see image), a raster feature is scaled by a factor of 2 on the Z axis. Note how the output values are all twice the original. 4e22154a-7e43-47c4-84e7-0c820ce8b56e

 

Scaling in FME Workbench is carried out using the Scaler transformer. The scale values refer to scale factors and are unrelated to the current working units.

 

Raster Cell Calculations

Besides offsetting and scaling, cell calculations can also be carried out using multiple cells as the operands in an equation. Various operations, including addition, subtraction, and multiplication, could be carried out.

For example, two raster features are being added together. The result is the sum of overlapping cells (see image): 

Uses of this technique include processing color/brightness in a raster image. 16fb632a-2bc4-4cab-b5d8-c22341b009dd
21b14d88-2692-4569-96ac-d77aad209c46 Or to combine raster datasets of different types together.

 

Using Raster Algebra in FME

Raster cell calculations in FME are carried out using the transformers RasterExpressionEvaluator and RasterCellValueCalculator. See the Common Imagery Tasks article for simple examples.

 

Understanding Resampling

Resampling is a process that changes a raster’s resolution. A new grid of cells is generated and overlaid on the original dataset, with cell values for the new grid taken from the existing cells.

The new grid may consist of larger cells, in which case the new raster would be coarser than the original and thereby be a smaller size. The trade-off is lessened precision since cells with different values might be merged into a single cell with just one value.

 

Several different resampling methods exist to transfer values from its original grid to a new one:

  1. Nearest Neighbor sampling simply means that a new cell takes the value of whatever old cell is the closest, or – to be more precise – the new cell takes the value of whatever existing cell whose origin is closest to the new cell’s origin. Importantly, only one cell provides a value; other surrounding cells have no bearing on the result. 
  2. Bilinear sampling is when a new cell takes a number of surrounding cells and interpolates a new value according to the linear distance to each.
  3. Bicubic sampling is when a continuous surface is interpolated, and new cell values are extracted.
  4. Average4 and Average16 sampling is when each new cell value is an average of the current 4 or 16 cells that surround it. These methods are best for use with DEM data.

 

Resampling Data in FME

Raster resampling in FME is carried out using the RasterResampler transformer. The new size (after resampling) can be defined by either:

  • The number of rows and columns
  • The size of the new cells
  • A percentage of the original raster resolution

See the Common Imagery Tasks article for a simple example.

Compression and Resampling are two entirely different processes, and Compression techniques are not always based on Resampling. ECW and JPEG2000, for example, use wavelet transformations for compressing datasets. See the Image Compression in FME article for an explanation and an example of image compression.

 

Understanding Pyramiding

Pyramids are lower-resolution views of a dataset. When writing a raster dataset, several pyramids can be created at various lower resolutions to be used in place of the original raster when only a snapshot or overview of the data is required.

An example of when a pyramid is typically employed is when a raster viewer zooms out, leaving a smaller raster with less detail. For performance reasons, the smaller raster is often rendered using a cached pyramid instead of resampling the image to a lower resolution at the time of the zoom-out request.

 

Pyramiding Data in FME

FME can create native pyramids for formats such as Oracle Spatial GeoRaster and Esri Geodatabase Raster. This operation can be done with Feature Type parameters.

For general pyramiding, a RasterPyramider transformer will create a set of pyramids for any raster data. 

With the RasterPyramider, pyramids can be defined by either the size of the smallest level or the number of levels of pyramiding. Again, there are parameters for the interpolation type and attributes to be added to the data. See the Common Imagery Tasks article for a simple example.

 

Understanding Tiling

Tiling is when source data is divided into any number of square or rectangular outputs based on a specific user-defined tile size.

Because data delivered via the web can be individual tiles rather than the entire dataset, the volume of data being transferred is significantly reduced. The trade-offs are artificial boundaries plus a pause when a new tile needs to be downloaded.

 

Tiling Data in FME

Tiling in FME is done with the RasterTiler transformer. Unlike the Clipper, this transformer needs no pre-defined boundaries.

Tiling can be defined by either tile size or number of tiles. If a raster had 10 meter cells, 1000 columns, and 1000 rows, with 5000m by 5000m specified as the tile size, one would get four tiles or four new raster features as output.

There is also an option to decide whether edge tiles should be truncated at the exact edge of the data or whether they will be padded with ‘nodata’ to the full extent of the tile size.

The transformer adds a number of attributes to identify each raster tile, and these could be used in a Fanout to label each output dataset with the appropriate row and column ID. See the Tiling Raster Data with the RasterTiler article for a simple example.

 

Data Attribution

The data used here originates from open data made available by the British Columbia Open Data Portal and the City of Austin Open Data Portal. It contains information licensed under the Open Government License - British Columbia and the Terms of Use for the City of Austin Open Data Portal. Unsplash Image (flower): Photo by Rae Galatas on Unsplash

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.