Image Analysis
MSc Data Science & Society
Tilburg University
1
,Module 1 Introduction
Digital Images
The values of digital images are all discrete and integers. The values can be considered as a large
(numpy) array of discrete dots. Each dot has a brightness associated with it. These dots are called
picture elements (= pixels).
The pixels surrounding a given pixel is its
neighborhood. A neighborhood can be
characterized by its shape (e.g., 3X5
neighborhood). Usually, the neighborhood is an
odd number. If the neighborhood is an even
number, interpolation is involved.
Images are represented as matrices (e.g., numpy arrays). The intensity of each
coordinate, each pixel, can be written as a function f(x, y), where x is the row
number and y is the column number. Note that the origin (0,0) of an image
is top left (instead of bottom left, e.g., when plotting a graph).
Types of Images
Binary Images Each pixel is either black (0) or
white (1). You only need one bit to
represent the pixel. In terms of
memory, binary images take the
least amount of memory.
Grayscale Images Each pixel is a shade of gray.
Normally the values range from 0
(black) to 255 (white). Each pixel
can be represented by eight bits,
or exactly one byte. Other
grayscale ranges are used, but
generally are a power of 2 (22 = 4,
24 = 64). Pixel values can never be
negative before loading into
Python or any other application.
Color (multi-channel) Multi-channel images are a stack
images of multiple matrices; representing
the multiple channel values for
each pixel. E.g., RGB color is
described by the amount of red,
green and blue in it.
2
, Color Models
Red-Green-Blue RGB is a primary color model consisting of
Red, Green and Blue.
(RGB)
Cyan-Magenta- CMYK is a secondary color model.
Yellow-Black (CMYK) - Additive colors can be mixed to
produce the colors: Cyan, Yellow, and
White.
- Subtractive colors can be mixed to
produce the colors: Red, Green, Blue
and Black.
C = Cyan: green + blue = white – red
M = Magenta: red + blue = white – green
Y = Yellow: red + green = white – blue
K = Black
CMYK color models are used specifically
for print materials and for physical media
– it is mainly useful for printing.
HSV (Hue, Saturation, - Hue: the “true color” attribute (red,
green, blue, orange, yellow, and so
Value)1
on).
- Saturation: the amount by which the
color has been diluted with white. The
whiter the color, the lower the
saturation.
- Value: the degree of brightness – a
well-lit color has high intensity; a dark
color has low intensity.
HSL (Hue, Saturation, The hue and saturation in both of these
color models are the same, the only
Luminosity)
difference is the value. In the HSV model,
the value is the degree of brightness. A
well-lit color has a high intensity (value);
a dark color has a low intensity (value).
The original hue value has a luminosity of
128. When decreasing luminosity
(minimum is 0), the color becomes darker
(shade). When increasing luminosity
(maximum is 255), the color becomes
brighter (tint).
1
Hue and luminosity are represented in each R, G and B channel. Objects in images have distinct colors (hues) and
luminosities. Hues and luminosities are used to partition different areas of the image. Can we separate hue and
luminosity? Objects have different values of luminosity (brightness), but they might all have the same color. To
separate hue and luminosity, we make use of a different type of model: HSV color model.
3
, RGB to CMYK
RGB to HSV
Example
Amount of red Amount of green Amount of blue
True color The whiter, the Degree of brightness
lower the (well-lit has high
saturation value)
4