• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Basics
2======
3
4Images are essential in any image processing, vision and video project, and
5yet the variability in image representations makes it difficult to write
6imaging algorithms that are both generic and efficient. In this section we
7will describe some of the challenges that we would like to address.
8
9In the following discussion an *image* is a 2D array of pixels. A *pixel* is a
10set of color channels that represents the color at a given point in an image.
11Each *channel* represents the value of a color component. There are two common
12memory structures for an image. *Interleaved* images are represented by
13grouping the pixels together in memory and interleaving all channels together,
14whereas *planar* images keep the channels in separate color planes. Here is a
154x3 RGB image in which the second pixel of the first row is marked in red,
16in interleaved form:
17
18.. image:: ../images/interleaved.jpg
19
20and in planar form:
21
22.. image:: ../images/planar.jpg
23
24Note also that rows may optionally be aligned resulting in a potential padding
25at the end of rows.
26
27The Generic Image Library (GIL) provides models for images that vary in:
28
29* Structure (planar vs. interleaved)
30* Color space and presence of alpha (RGB, RGBA, CMYK, etc.)
31* Channel depth (8-bit, 16-bit, etc.)
32* Order of channels (RGB vs. BGR, etc.)
33* Row alignment policy (no alignment, word-alignment, etc.)
34
35It also supports user-defined models of images, and images whose parameters
36are specified at run-time. GIL abstracts image representation from algorithms
37applied on images and allows us to write the algorithm once and have it work
38on any of the above image variations while generating code that is comparable
39in speed to that of hand-writing the algorithm for a specific image type.
40
41This document follows bottom-up design. Each section defines concepts that
42build on top of concepts defined in previous sections. It is recommended to
43read the sections in order.
44