1.4 The nature of a computer image
In modern computer graphics, an image is solely a rectangular grid, or array of pixels.
Beyond what you see on the screen, it is, in reality, a two-dimensional array of numbers.
Each number represents the intensity or color of a visible picture element or pixel.
The word pixel supposedly stands for picture element.
It is the atomic unit of computer imagery and the smallest area on the view surface that can be accessed by a program.
The pixels in an image area themselves little rectangles, all the same size and shape.
Each pixel is one solid color throughout.
It is important to remember that a pixel is the logical picture element inside the computer.
Locations in CG are stored as mathematical coordinates, but the display surface of an output device is an actual physical object.
Thus, it is important to keep in mind the distinction between physical pixels and logical pixels.
Physical Pixels are the actual dots displayed on an output device.
Each one takes up a small amount of space on the surface of the device.
Physical Pixels are manipulated directly by the display hardware and form the smallest independently programmable physical elements on the display surface.
Because physical pixels cover a fixed area on the display surface, there are practical limits to how close together two adjacent pixels can be.
On the other hand, logical pixels are like mathematical points: they specify a location, but are assumed to occupy no area.
Thus, the mapping between logical pixel values in the bitmap data and physical pixels on the screen must take into account the actual size and arrangement of the physical pixels.
1.4 The nature of a computer image
Figure 1.1 illustrates the difference between physical and logical pixels.
Figure 1.1: Physical and logical pixels.
1.4 The nature of a computer image
1.4 The nature of a computer image
For the colored image, graphics system uses the red, green, blue (RGB) color space.
Colors are defined by specifying three values.
These values specify the amount of each of a set of fundamental colors which are mixed to produce composite colors.
A composite color is then specified as an ordered set of values.
A color is described as separate RGB component and each component vary from 0 to1, meaning black to maximum brightness or intensity.
You might characterize colors in the RGB color model as follows:
 |
(0,0,0) means black. |
 |
(1,1,1) means white. |
 |
(1,1,0) means yellow. |
1.4 The nature of a computer image
Figure 1.2 shows the RGB color cube.
This is what you get by mapping the separate red, green, and blue components to the coordinate axes.
Figure 1.2: The red, green, blue (RGB) color cube
The number of bits used to represent the color of each pixel is called Color depth.
Consequently, the highest quality images known as true-color images have a depth of 24 bits (one byte for each component).
1.4 The nature of a computer image
The word true-color comes up in discussions about images that contain a large number of colors.
If the space allotted for each color component is a byte (8 bits), the natural range is 0 to 255, with 0 representing zero intensity and 255 representing maximum intensity, so RGB = ([0-255], ([0-255],([0-255]).
When storing color data in a file, it is more practical to specify the value of each color component, not as a percentage, but as a value in a predefined range.
For instance, the pixel values for white color= (255, 255, 255), and red color= (255, 0, 0).
This example assumes that 0 stands for the least amount and 255 for the most amount of a particular color component.
Another common color space uses three numbers called intensity, hue, and saturation.
This approach is closer to the way people think about colors.
Usually, this kind of color space is found in the user interface.
The user interacts with the program using intensity, hue, and saturation, which are then converted to RGB for internal use.
Intensity is simply how light or dark the color is.
Hue describes whether the color is red, blue, Hawaiian coral pink, morning-sunset orange, or whatever.
Saturation is the color's boldness or vividness.
Pale or washed-out colors have a low saturation.
A saturation of 0 means you have a shade of grey.
1.4 The nature of a computer image
Elements of Pictures Created in Computer Graphics
A picture can be described in several ways.
We can describe a picture as a set of complex objects, such as trees and terrain or furniture and walls, positioned at specified coordinate locations within the scene.
Shapes and colors of the objects can be described internally with pixel arrays or with sets of basic geometric structures, such as straight line segments and polygon color areas.
The basic objects out of which such pictures are composed are called output primitives.
In computer graphics, a graphic primitive is something we know how to draw directly into a bitmap, such as a line, a point, and some polygons.
Points and straight line segments are the simplest geometric components of pictures.
For each primitive there is an attribute associated with it.
The attributes of a graphic primitive are the characteristics that affect how it appears, such as color and thickness. For now, we need to understand the basic graphic primitives at our disposal.
 |
Point |
|
 |
What's there to say about a point primitive, is it just a dot, right? Yeah, mostly. In computer graphics the smallest thing we can draw directly is a pixel. |
|
 |
A point is often drawn as one pixel. |
1.4 The nature of a computer image
|
 |
Note that a polyline can appear as a smooth curve; refer to figure 1.4 as an example. |
Figure 1.4: a curved line made up of straight-line segments
1.4 The nature of a computer image
|
 |
When there are several lines in a polyline, each one is called an edge, and two adjacent lines meet at a vertex. The edges of a polyline can cross one another. |
 |
Polygon |
|
 |
A polyline need not form a closed figure, but if the first and last points are connected by an edge, the polyline is a polygon. |
|
 |
If in addition, no two edges cross, the polygon is called simple. |
|
 |
A mathematical polygon is a bunch of line segments connected end to end in a closed loop. |
|
 |
In computer graphics, we usually care more about the surface inside the line segments, and generally mean that when we use the term polygon. |
|
 |
An important property of a polygon is whether it is convex or concave. |
|
 |
Figure 1.5 shows some 2D examples. |
|
 |
If you draw a line over a convex polygon, the line will cross the polygon only once, no matter where you draw the line. |
1.4 The nature of a computer image
Figure 1.5: Examples of 2D polygon primitives
|
Figure 1.6: Examples of Polygons
|
Figure 1.5: Figure 1.7: Examples of n-gons
1.4 The nature of a computer image
Figure 1.8: Example of a Triangle Strip Primitive
 |
Quad Mesh Primitive |
|
 |
A quad mesh is the same idea as a Triangle Strip, except that the primitives are quadrilaterals, and an entire mesh instead of just one strip is drawn. |
1.4 The nature of a computer image
|
 |
Quad meshes can be very efficient means to draw complicated surfaces that are defined by a rectangular grid of points (see figure 1.9). |
Figure 1.9: Example of a Quad mesh Primitive
1.4 The nature of a computer image
|
 |
There are many text attributes, the most important of which are the text's font (type-face), color size, spacing, and orientation. |
Figure 1.10: Some text drawn graphically
1.4 The nature of a computer image
|
 |
Algorithms for performing the filling action with OpenGL will be discussed in chapter 3. |
Figure 1.11: Examples of filled polygons
1.4 The nature of a computer image
|
 |
Suppose that the three grey levels are encoded as the values 1, 2, and 7. |
|
 |
Figure 1.13(b) shows the numerical values of the pixel map for the upper left 6-by-8 portion of the image. |
Figure 1.13: A simple figure represented as a bitmap
1.4 The nature of a computer image
|
 |
There are three principle sources for creating raster images:
- Hand-designed images: with this technique, designer figures out what values are needed for each cell and type them into memory. Sometimes a paint program can be used to help automate the process. The icon in figure 1.13 was created this way.
- Computed images: an algorithm is used to render a scene, which might be modeled abstractly in computer memory.
- Scanned images: a photograph or television image can be digitized. In effect, a grid is placed over the original image, and at each grid point, the digitizer reads into memory the closest color in its repertoire. The bitmap thereby created is then stored in a file for later use. The image of the kitty in figure 1.14 was formed in this way.
|
Figure 1.14: A scanned image
|
|
1.4 The nature of a computer image
 |
Color Raster Images |
|
 |
Color raster images have become more common in recent years as the cost of high-quality color displays has come down. |
|
 |
Each pixel in a color image has a color value, a numerical value that somehow represents a color. |
|
 |
One of the most common ways to associate numbers with colors is to describe a color as a combination of amounts of red, green, and blue light. |
|
 |
Each pixel value is an ordered triple such as (23,14,51), that prescribes the intensities of the red, green, and blue components in that order. |
|
 |
The number of bits used to represent the color of each pixel is often called the color depth of the pixel. |
|
 |
The highest quality images, known as true-color images, have a color depth of 24 and so use a byte for each component. |
1.4 The nature of a computer image
1.4 The nature of a computer image
1.4 The nature of a computer image
1.4 The nature of a computer image
1.4 The nature of a computer image
1.4 The nature of a computer image