Mathematica 9 is now available

Image Representation

This loads the package.


A digital image is a two-dimensional (2-D) discrete signal. Mathematically, such signals can be represented as functions of two independent variables, for example, a brightness function of two spatial variables. A monochrome digital image [Graphics:Images/Jankowski_ImageProcessing_gr_2.gif] is a 2-D array of luminance values,


with  [Graphics:Images/Jankowski_ImageProcessing_gr_4.gif], and typically [Graphics:Images/Jankowski_ImageProcessing_gr_5.gif]. Each element of the array is called a pel (picture element), or more commonly pixel. Typical image dimensions are [Graphics:Images/Jankowski_ImageProcessing_gr_6.gif] and [Graphics:Images/Jankowski_ImageProcessing_gr_7.gif].

Consider a small portion of the "head" image, one of the monochrome example images. We read the image and extract the raw pixel data. The example images included in the ImageProcessing package are located in the Data directory of the root ImageProcessing directory. The location on any system, is given by the system variable $ImageDataDirectory. In a typical  Windows installation the path may be as follows.


The directory paths listed in this system variable are automatically searched for named files in an ImageRead operation.

[Graphics:Images/Jankowski_ImageProcessing_gr_10.gif] [Graphics:Images/Jankowski_ImageProcessing_gr_11.gif][Graphics:Images/Jankowski_ImageProcessing_gr_12.gif]

Small values represent dark areas of an image, while large values represent bright pixels.

A color digital image is typically represented by a triplet of values, one for each of the color channels, as in the frequently used RGB color scheme. The individual color values are almost universally 8-bit values, resulting in a total of 3 bytes (or 24-bits) per pixel. This yields a three-fold increase in the storage requirements for color versus monochrome images.  Naturally, there are a number of alternative methods of storing the image data. Most widely used are the so-called pixel-interleaved (or meshed) and color interleaved (or planar) formats. Less frequent, but possible are row-wise or column-wise interleaving methods. In a pixel-interleaved format every image pixel is represented by a list of three values:


whereas in the color-interleaved format, the color information is separated into three matrices, one for each of the three color channels:


Here we read the color example image - "beans".


Here we extract a 4x4 region and display it in a meshed format.


Here, the same region of the color image is displayed in a planar format.


The RGB color scheme is just one of many color representation methods used in practice. The letters R, G, B stand for red, green and blue, the three primary colors used to synthesize any one of [Graphics:Images/Jankowski_ImageProcessing_gr_20.gif] or approximately 16 million colors. Equal quantities of the three color values result in shades of gray in the range {0, 255}. Other supported color models, include monochrome, HSV which stands for hue, saturation, value and CMYK which stands for cyan, magenta, yellow. The latter has found application primarily in the printing and graphics markets. HSV is useful in color image processing, since it separates the color information from brigthness.

Further reading

Getting Started: How to find the example image?

User's Guide: Sections 2.1, 2.2, 2.3.

Function Index: ImageRead, ImageTake, PlanarImageData, RawImageData.