Lect 3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

Data Visualization

(Lecture 3)
4) Raster Images
 Such an image is a 2-dimensional array of pixels.
 Such images are sometimes called pixel maps.
 For gray-scale (or monochrome) raster images, each pixel is
represented by assigning it a numerical value over some range (e.g.,
from 0(black) to 255(white).
4) Raster Images
Graphics Display Systems
Vector display Raster scan display

 Driven by display commands  Driven by array of pixels (lowest form


of representation)
 (move (x, y), char(“A”) ,  Aliasing errors due to discrete sampling
line(x,y)…) of continuous primitives

Ideal Vector
Drawing Drawing Outline Filled
Graphics Display Systems
Vector display Raster scan display

 The image is represented by the  The image is represented by


lines approximating it discrete pixel intensities
 The time depends on the  The system scans memory in a
complexity of the image constant time
 The quality is high  Image quality depends on the pixel
size and resolution
Conceptual Framework for Interactive Graphics
 Graphics library/package is intermediary between application and display
hardware (Graphics System)
 Application program maps application objects to views (images) of those
objects by calling on graphics library.
 Application model may contain lots of non-graphical data (e.g., non-
geometric object properties)
 User interaction results in modification of image and/or model
Software Hardware

Graphics
System/
Application Graphics GPU
Application
Library
Model / database program
Graphics Library
 Examples: OpenGL™, DirectX™, Windows Presentation
Foundation™ (WPF) accessed via XAML, RenderMan™,
HTML5 + WebGL™
 Primitives (characters, lines, polygons, meshes,…)
 Attributes
 Color, line style, material properties for 3D

 Lights
 Transformations
 Immediate mode vs. retained mode
Graphics Library
 immediate mode: no stored
representation, package holds
only attribute state, and
application must completely
draw each frame

 retained mode: library compiles


and displays from scenegraph
that it maintains.
Application Distinctions: Two Basic Paradigms
Sample-based graphics vs Geometry-based graphics
Sample-based Graphics
 Sample-based graphics: Discrete samples
are used to describe visual information
 pixels can be created by digitizing images,
using a sample-based “painting” program,
etc.
 example programs: Adobe Photoshop™,
GIMP™ , Adobe AfterEffects™
Sample-based Graphics
 Pixels are point locations with associated sample values, usually of light
intensities/colors, transparency, and other control information
 When we sample an image, we sample the point location along the
continuous signal and pixels may be displayed as such

CRT* beam illumination pattern

Visualization of a
mathematical pixel grid LCD display

* Cathode Ray Tube, like those really old TVs


Sample-based Graphics
 Samples created directly in Paint-type program, or by sampling of
continuous (analog) visual materials (light intensity/color measured at
regular intervals) with many devices including:
 flatbed and drum scanners
 digital still and motion (video) cameras
 Sample values can also be input numerically (e.g., with numbers from
computed dataset)
Sample-based Graphics
 Once an image is defined as pixel-array, it can be manipulated
 Image editing: changes made by user, such as cutting and pasting
sections, brush-type tools, and processing selected areas
 Image processing: algorithmic operations that are performed on image
(or pre-selected portion of image) without user intervention. Blurring,
sharpening, edge-detection, color balancing, rotating, warping.
Sampling an Image
 Lets do some sampling of CIT building

3D scene

 A color value is measured at every grid point and used to color corresponding
grid square 0 = white, 5 = gray, 10 = black

 Crude sampling and image reconstruction method creates blocky image


What’s the Advantage?
 Once image is defined in terms of colors at
(x, y) locations on grid, can change image
easily by altering location or color values
(E.g., reverse the mapping and make 10 =
white and 0 = black)
 Pixel information from one image can be
copied and pasted into another, replacing
or combining with previously stored pixels
What’s the Disadvantage?
 WYSIAYG (What You See Is All You
Get): No additional information
 no depth information
 can’t examine scene from different
point of view
 at most can play with the individual
pixels or groups of pixels to change
colors, enhance contrast, find edges,
etc.
Geometry-Based Graphics
 Geometry-based graphics (also called scalable
vector graphics or object-oriented graphics):
geometrical model is created, along with various
appearance attributes, and is then sampled for
visualization (rendering)
 often some aspect of physical world is visually
simulated, or “synthesized”
 examples of 2D apps: Adobe Illustrator™ and Corel
CorelDRAW™
 examples of 3D apps: Autodesk’s AutoCAD™,
Autodesk’s (formerly Alias|Wavefront’s) Maya™,
Autodesk’s 3D Studio Max™
Geometry-Based Graphics
 Geometry-based graphics applications
 Store mathematical descriptions, or “models,” of geometric elements (lines,
polygons, polyhedrons, polygonal meshes…) and associated attributes (e.g., color,
material properties).
 Geometric elements are primitive shapes, primitives for short.
 Images are created via sampling of geometry for viewing, but not stored as part of
model.
 Users cannot usually work directly with individual pixels in geometry-based
programs; as user manipulates geometric elements, program resamples and
redisplays elements
 Increasingly rendering combines geometry- and sample-based graphics to
increase quality of final product
 CG animated characters (geometry) on painted or filmed scene images (samples)
Decomposition of a Geometric Model
 Divide
 Hierarchy of geometrical components
 Reduction to primitives (e.g., spheres, cubes, etc.)

Head
Shaft
Point
composition decomposition
Hierarchical (Tree) Diagram of Nail
 Tree diagram provides visual method of expressing “composed of”
relationships of model

Nail root node


Head Body
(cylinder)
Shaft Point leaf nodes
(cylinder) (cone)
tree diagram

 Such diagrams are part of 3D program interfaces (e.g., 3D Studio MAX,


Maya)
 As a data structure to be rendered, it is called a scenegraph
3D Object Definition
 Points: x, y, z
 Line: two points
 Polygon: list of vertices, color/texture
 Polyhedron: a region of 3-space bounded by polygons
 Object : a group of connected polygons

+Y +Y

Polygons

+Z +Z +X
+X
3D Object Definition
 Convex and concave polygons:
 Convex: Line between any two points is inside polygon
 Concave: At least one line between two points crosses outside polygon

convex concave
3D Object Definition
 Special Polygons:

Triangle Square Rectangle

 Circles: (x, y)
(0, y)
 Set of all points equidistant r
from one point called the center
(0, 0) (x, 0)
 The distance from the center
is the radius r
3D Object Definition
 A circle can be approximated by a polygon with many sides.

 Axis aligned ellipse: a circle scaled in the x and/or y direction


6 6
5 5
4 4
3 3
2 2
1 1

0 0
1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10

Scaled by a factor of 2 in the x direction (the width of circle) and not scaled in the y
direction. Width changes from 2.5 to 5.
Representing Shapes
 We specify objects as a set of vertices and associated attributes. This
information can be stored in tables, of which there are two types:
geometric tables and attribute tables.
 The geometry tables can be stored as three tables:
 A vertex table: each entry in the vertex table is a list of coordinates
defining that point (v1: x1, y1, z1).
 An edge table: each entry in the edge table consists of a pointer to each
endpoint of that edge (E1: v1, v2).
 A polygon table: the entries in the polygon table define a polygon by
providing pointers to the edges that make up the polygon (S1: E1, E2, and
E3).
Representing Shapes
 We can eliminate the edge table by letting the polygon table reference
the vertices directly, but we can run into problems, such as:
 Drawing some edges twice, because we don't realize that we have visited the
same set of points before, in a different polygon.
 Waste space because the same points appear in the polygon table several
times.
 Using all three tables allows for certain kinds of error checking:
 We can confirm that each polygon is closed
 Each point in the vertex table is used in the edge table
 Each edge is used in the polygon table.
Representing Shapes
 Tables also allow us to store additional information:
 Each entry in the edge table could have a pointer back to the polygons that
make use of it. This would allow for quick look-up of those edges which are
shared between polygons.
 We could also store the slope of each edge or the bounding box for each
polygon (values which are repeatedly used in rendering)
Representing Shapes
Representing Shapes
Representing Shapes

You might also like