discrete data structure and colour mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf ·...

43
Visualisation : Lecture 5 Discrete Data Structure and Colour Mapping Computer Animation and Visualisation – Lecture 10 Taku Komura Taku Komura Colour Mapping 1 Institute for Perception, Action & Behaviour School of Informatics

Upload: others

Post on 28-Jun-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Discrete Data Structure and Colour MappingColour Mapping

Computer Animation and Visualisation –Lecture 10

Taku Komura

Taku Komura Colour Mapping 1

Institute for Perception, Action & BehaviourSchool of Informatics

Page 2: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Overview

� Discrete data structure

� Topology and interpolation

Topological dimension� Topological dimension

� Data Representation

− Structure � Topology - Cells

� Geometry - points

− Attributes

Taku Komura Colour Mapping 2

− Attributes

� Colour Mapping

Page 3: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Discrete Vs. Continuous

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

� Data is discrete� 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

Taku Komura Colour Mapping 3

− we need topology and interpolation

Page 4: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Topology� Topology : relationships within the data invariant

under geometric transformation

− Which vertex is connected with which vertex by an edge?− Which vertex is connected with which vertex by an edge?

− Which area is surrounded by which edges?

Taku Komura Colour Mapping 4

Page 5: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Interpolation & Topology

� If we introduce topology our visualisation of discrete data improves

Taku Komura Colour Mapping 5

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

Page 6: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Interpolation & Topology

� Use interpolation to shade whole cube:

Taku Komura Colour Mapping 6

− Interpolation: producing intermediate samples from a discrete representation

Page 7: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Taku Komura Colour Mapping 7

Page 8: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Importance of representation

� What happens if we change the representation?

Taku Komura Colour Mapping 8

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

Page 9: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Taku Komura Colour Mapping 9

Page 10: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

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 GeometricTopological Geometricpoint 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 e.g. MRI or CT scan

Temporal volume 4D 3D (+ t)

Taku Komura Colour Mapping 10

Page 11: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Structure of Data

� Structure has 2 main parts

− topology : “set of properties invariant under certain geometric transformations”geometric transformations”

� determines interpolation required for visualisation

� “shape” of data

− geometry

� instantiation of the topology

OR

Taku Komura Colour Mapping 11

� specific position of points in geometric space

Page 12: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Data Representation

� Data objects : structure + value

− referred to as datasets

Structure- Topology- Geometry

—————————Cells, points (grid)

—————————

Consists of

Abstract

Concrete

Taku Komura Colour Mapping 12

—————————Data Attributes

—————————Scalars, vectorsNormals, texture

coordinates, tensors etc

Page 13: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Dataset Representation of the Structure

� Points specify where the data is known

− specify geometry in ℝN

Cells allow us to interpolate between points

� Cells allow us to interpolate between points

− specify topology of pointsPoint with known attribute data (i.e. colour ≈ temperature)

Taku Komura Colour Mapping 13

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

Page 14: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

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

Taku Komura Colour Mapping 14

� composite : consists of one or more primary cells

Page 15: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Zero-dimensional cell types� Vertex

− Primary zero-dimensional cell− Definition: single point

� Polyvertex− Composite zero-dimensional cell

� composite : comprises of several vertex cells

− Definition: arbitrarily ordered set of points

Taku Komura Colour Mapping 15

Page 16: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

One-dimensional cell types� Line

− Primary one-dimensional cell type− Definition: 2 points, direction is from first to

second point.second point.

� Polyline− Composite one-dimensional cell type− Definition: an ordered set of n+1 points, where

n is the number of lines in the polyline

Taku Komura Colour Mapping 16

n is the number of lines in the polyline

Page 17: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Two-dimensional cell types - 1� Triangle

− Primary 2D cell type

− Definition: counter-clockwise ordering of 3 points� order of the points specifies the direction of the surface normal

� Triangle strip

− Composite 2D cell consisting of a strip of triangles

− Definition: ordered list of n+2 points� n is the number of triangles

� Quadrilateral

− Primary 2D cell type

Taku Komura Colour Mapping 17

− Definition: ordered list of four points lying in a plane� constraints: convex + edges must not intersect� ordered counter-clockwise defining surface normal

Page 18: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Two-dimensional cell types - 2� Pixel

− Primary 2D cell, consisting of 4 points� topologically equivalent to a quadrilateral

constraints: perpendicular edges; axis aligned� constraints: perpendicular edges; axis aligned

− numbering is in increasing axis coordinates

� Polygon− Primary 2D cell type− Definition: ordered list of 3 or more points

� counter-clockwise ordering defines surface normal� constraint: may not self-intersect

Taku Komura Colour Mapping 18

� constraint: may not self-intersect

Page 19: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Three-dimensional cell types� Tetrahedron

− Definition: list of 4 non-planar points

� Six edges, four faces

� Hexahedron

− Definition: ordered list of 8 points

� six quadrilateral faces, 12 edges, 8 vertices

� constraint: edges and faces must not intersect

� Voxel

− Topologically equivalent to Hexahedron

Taku Komura Colour Mapping 19

− constraint: each face is perpendicular to a coordinate axis

− “3D pixels”

Page 20: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

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)

Taku Komura Colour Mapping 20

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

− tensor (N dimensional array)

Page 21: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Attribute Data : Scalar

� Single valued data at each location

Taku Komura Colour Mapping 21

− simplest and most common form of visualisation data

volume density (MRI)elevation from reference plane

ozone levels

Page 22: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Attribute Data : Vector Data

� Magnitude and direction at each location

− 3D triplet of values (i, j, k)− 3D triplet of values (i, j, k)

Wind Speed

Taku Komura Colour Mapping 22

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

Magnetic Field

Force / DisplacementWind Speed

Page 23: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

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− 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

Taku Komura Colour Mapping 23

� Example : Tensor Stress

Page 24: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Visualisation Algorithms� Generally, classified by attribute type

− scalar algorithms (e.g. colour mapping)

− vector algorithms (e.g. glyphs)− vector algorithms (e.g. glyphs)

− tensor algorithms (e.g. tensor ellipses)

Taku Komura Colour Mapping 24

Page 25: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Scalar Algorithms

� Scalar data : single value at each location

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

− we want to visualise the scalar within this structure

Taku Komura Colour Mapping 25

� Two fundamental algorithms

− colour mapping (transformation : value → colour)

− contouring (transformation : value transition → contour)

Page 26: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Colour Mapping

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

� scalar value = height / max elevation� scalar value = height / max elevation

� colour range = blue →red

� Colour Look-up Tables (LUT)

− provide scalar to colour conversion

− scalar values = indices into LUT

Taku Komura Colour Mapping 26

Page 27: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Colour LUT� Assume

− scalar values Si in range {min→max}

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

� Define mapped colour C :

− if Si < min then C = colourmin

− if Si > max then C = colourmax

− else

colour0

colour1colour2

SiC

LUT

Taku Komura Colour Mapping 27

− else

colourn-1

C= colour�S

i− min

max− min�

Page 28: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Colour Transfer Function� More general form of colour LUT

� A continuous function instead of a discrete LUT

− scalar value S; colour value C− 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

Taku Komura Colour Mapping 28

skin/bone/tissue colours

Page 29: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

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

Taku Komura Colour Mapping 29

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

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

Page 30: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

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 :

Taku Komura Colour Mapping 30

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

Page 31: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Example� Winding numbers :

− say we have a curve on a 2D plane

− How much a point is surrounded by the curve− How much a point is surrounded by the curve� Winding numbers

− We can calculate the winding numbers at every location

Taku Komura Colour Mapping 31

� 1/4 1 0

Page 32: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Winding numbers visualized by grey scale

� Cup with an open top Star with an open top

� A bar

Taku Komura Colour Mapping 32

� A bar

Page 33: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Color Spaces – RGB Combining different channels to define a mapping function

B(x) R(x)

Taku Komura Colour Mapping 33

Page 34: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Winding numbers visualized by red and blue

� Cup with an open top Star with an open top

� A bar

Taku Komura Colour Mapping 34

� A bar

Page 35: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

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

Taku Komura Colour Mapping 35

� V (Value) = brightness of colour

− brightness of the colour

Page 36: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

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

Taku Komura Colour Mapping 36

− use hue range for colour gradients

− very useful for scalar visualisation with colour ma ps

Page 37: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Example : HSV image components

Taku Komura Colour Mapping 37

Page 38: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Winding numbers by HSV (only changing hue)

� Cup with an open top Star with an open top

� A bar

Taku Komura Colour Mapping 38

Page 39: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Different Colour Spaces� Visualising gas density in a combustion chamber

− Scalar = gas density

− Colour Map =

A BA: grayscale

B: hue range blue to red

C: hue range red to blue

D: specifically designedtransfer function

� highlights contrast

Taku Komura Colour Mapping 39

C D

� highlights contrast

Page 40: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Color maps from Matlab

Taku Komura Colour Mapping 40

Page 41: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Colour Table/Transfer Function Design

� “More of an art than a science”

� 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)

Taku Komura Colour Mapping 41

− 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 42: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Examples of Manually Designed LUT3D Height Data

Taku Komura Colour Mapping 42

HSV based colour transfer function

− continuous transition of height represented

8 colour limited lookup table

− discrete height transitions

− Based on human knowledge

Page 43: Discrete Data Structure and Colour Mappinghomepages.inf.ed.ac.uk/tkomura/cav/presentation10.pdf · Visualisation : Lecture 5 Two-dimensional cell types - 1 Triangle − Primary 2D

Visualisation : Lecture 5

Summary

� Discrete data structure

� Topology and interpolation

Topological dimension� Topological dimension

� Data Representation

− Structure � Topology - Cells

� Geometry - points

− Attributes

Taku Komura Colour Mapping 43

− Attributes

� Colour Mapping