discrete data structure and colour...

40
Discrete Data Structure and Colour Mapping Computer Animation and Visualisation Lecture 11 Taku Komura Institute for Perception, Action & Behaviour School of Informatics

Upload: others

Post on 27-May-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Discrete Data Structure and Colour Mapping

Computer Animation and Visualisation – Lecture 11

Taku Komura

Institute for Perception, Action & Behaviour School of Informatics

Page 2: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Overview

About Visualization

Scientific Visualisation

Information Visualisation

Discrete data structure

Topology and interpolation

Data Attributes

Colour Mapping

Page 3: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize
Page 4: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Techniques in Visualisation

Scientific Visualisation

Visualising numbers with spatial structure

Information Visualisation

Visualising abstract data with no spatial structure

Page 5: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Discrete Vs. Continuous

Real World is continuous eyes designed towards the perception of continuous shape

Data is discrete finite resolution representation of a real world (of abstract) concept

Difficult to visualise continuous shape from raw discrete sampling

we need topology and interpolation

Page 6: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Topology

Topology : relationships within the data invariant under geometric transformation

Which vertex is connected with which vertex by an edge?

Which area is surrounded by which edges?

Page 7: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Interpolation & Topology

If we introduce topology our visualisation of discrete data improves

why ? : because then we can interpolate based on the topology

Page 8: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Interpolation & Topology

Use interpolation to shade whole cube:

Interpolation: producing intermediate

samples from a discrete representation

Page 9: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize
Page 10: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Importance of representation

What happens if we change the representation?

Discrete data samples remain the same topology has changed ⇒ effects interpolation ⇒ effects visualisation

Page 11: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize
Page 12: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Dataset Representation of the Structure

Points specify where the data is known

specify geometry in ℝN

Cells allow us to interpolate between points

specify topology of points

Point with known attribute data (i.e. colour ≈ temperature)

Cell (i.e. the triangle) over which we can interpolate data.

Page 13: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Cells

Fundamental building blocks of visualisation

our gateway from discrete to interpolated data

Various Cell Types

defined by topological dimension

specified as an ordered point list (connectivity

list)

primary or composite cells

- composite : consists of one or more primary cells

Page 14: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Vertex (0D) Line (1D) Triangle, pixel, quad (2D) Triangle mesh, polygon mesh (2D) Tetrahedra, voxel (3D)

Various Cell types

Page 15: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Topological Dimension Topological Dimension: number of independent continuous variables

specifying a position within the topology of the data

different from geometric dimension (position within general space)

Topological Geometric

point 0D 2D/3D/… e.g. 2D (x,y)

curve 1D 2D/3D/… e.g. 3D point on curve

surface 2D 3D (in general)

volume 3D 3D (in general) e.g. MRI or CT scan

Temporal volume 4D 3D (+ t)

Page 16: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Data Representation

Data objects : structure + value

referred to as datasets

Structure

Points, Cells

—————————

Data Attributes

Scalars, vectors

Normals, texture

coordinates, tensors etc

Page 17: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Attribute Data Information associated with data topology

usually associated to points or cells

Examples : temperature, wind speed, humidity, rain fall (meteorology)

heat flux, stress, vibration (engineering)

texture co-ordinates, surface normal, colour (computer graphics)

Usually categorised into specific types:

scalar (1D)

vector (commonly 2D or 3D; ND in ℝN)

tensor (N dimensional array)

Page 18: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Attribute Data : Scalar

Single valued data at each location

simplest and most common form of visualisation data

volume density (MRI) elevation from reference plane

ozone levels

Page 19: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Attribute Data : Vector Data

Magnitude and direction at each location 3D triplet of values (i, j, k)

Also Normals – vectors of unit length (magnitude = 1)

Magnetic Field

Force / Displacement Wind Speed

Page 20: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Attribute Data : Tensor Data

K-dimensional array at each location

Generalisation of vectors and matrices Tensor of rank k can be considered a k-

dimensional table - Rank 0 is a scalar - Rank 1 is a vector - Rank 2 is a matrix - Rank 3 is a regular 3D array

- Example : Tensor Stress

Page 21: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Visualisation Algorithms Generally, classified by attribute type

scalar algorithms (e.g. colour mapping, contouring )

vector algorithms (e.g. glyphs, lines)

tensor algorithms (e.g. tensor ellipses)

Page 22: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Scalar Algorithms

Scalar data : single value at each location

Structure of data set may be 1D, 2D or 3D+

we want to visualise the scalar within this structure

Two fundamental algorithms

colour mapping (transformation : value → colour)

contouring (transformation : value transition → contour)

Page 23: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Colour Mapping

Map scalar values to colour range for display e.g.

- scalar value = height / max elevation

- colour range = blue →red

Colour Look-up Tables (LUT)

provide scalar to colour conversion

scalar values = indices into LUT

Page 24: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Colour LUT Type equation here.Assume

scalar values Si in range {min→max}

n unique colours, {colour0... colourn-1} in LUT

Define mapped colour C:

if Si < min then C = colourmin

if Si > max then C = colourmax

else

colour0

colour1

colour2

colourn-

1

Si C

LUT

𝐶 = color𝑆𝑖 − 𝑚𝑖𝑛

𝑚𝑎𝑥 − 𝑚𝑖𝑛

Page 25: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Colour Transfer Function

More general form of colour LUT

A continuous function instead of a discrete LUT scalar value S; colour value C

colour transfer function : f(S) = C

e.g. define f() to convert densities to realistic skin/bone/tissue colours

Page 26: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Colour Spaces - RGB Colours represented as R,G,B intensities

3D colour space (cube) with axes R, G and B

each axis 0 → 1 (below scaled to 0-255 for 1 byte per colour channel)

Black = (0,0,0) (origin); White = (1,1,1) (opposite corner)

Problem : difficult to map continuous scalar range to 3D space

- can use subset (e.g. a diagonal axis) but imperfect

Page 27: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Colour Spaces - Greyscale Linear combination of R, G, B

Defined as linear range

easy to map linear scalar range to grayscale intensity

can enhance structural detail in visualisation - The shading effect is emphasized

- as distraction of colour is removed

not really using full graphics capability

lose colour associations :

e.g. red=bad/hot, green=safe, blue=cold

Page 28: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Example

Winding numbers : say we have a curve on a 2D plane How much a point is surrounded by the curve

- Winding numbers

We can calculate the winding numbers at every location

- 1/4 1 0

Page 29: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Winding numbers visualized by grey scale

Cup with an open top Star with an open top

A bar

Page 30: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Color Spaces – RGB

B(x) R(x)

Combining different channels to define a mapping function

Page 31: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Winding numbers visualized by red and blue

Cup with an open top Star with an open top

A bar

Page 32: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Colour spaces - HSV

Colour represented in H,S,V parametrised space

commonly modelled as a cone

H (Hue) = dominant wavelength of colour

colour type {e.g. red, blue, green...}

S (Saturation) = amount of Hue present

“vibrancy” or purity of colour

V (Value) = brightness of colour

brightness of the colour

Page 33: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Colour spaces - HSV HSV Component Ranges

Hue = 0 → 360o

Saturation = 0 → 1

- e.g. for Hue≈blue

0.5 = sky colour; 1.0 = primary blue

Value = 0 → 1 (amount of light)

- e.g. 0 = black, 1 = bright

All can be scaled to 0→100% (i.e. min→max) use hue range for colour gradients

very useful for scalar visualisation with colour maps

Page 34: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Example : HSV image components

Page 35: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Winding numbers by HSV (only changing hue)

Cup with an open top Star with an open top

A bar

Page 36: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Different Colour Spaces

A B

C D

Visualising gas density in a combustion chamber

Scalar = gas density

Colour Map =

A: grayscale

B: hue range blue to red

C: hue range red to blue

D: specifically designed transfer function

- highlights contrast

Page 37: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Color maps from Matlab

Page 38: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Colour Table/Transfer Function Design

Key focus of colour table design

emphasize important features / distinctions

minimise extraneous detail

Often task specific

consider application (e.g. temperature change, use hue red to blue)

Rainbow colour maps – rapid change in colour hue

representing a ‘rainbow’ of colours.

shows small gradients well as colours change quickly.

Page 39: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Examples of Manually Designed LUT 3D Height Data

HSV based colour transfer function

continuous transition of height represented

8 colour limited lookup table

discrete height transitions

Based on human knowledge

Page 40: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation11_2013.pdf · Colour Table/Transfer Function Design Key focus of colour table design emphasize

Summary

Discrete data structure

Topology and interpolation

Topological dimension

Data Representation

Structure - Topology - Cells

- Geometry - points

Attributes

Colour Mapping