"A virtual image, a point or a set of points, if seen on one side of a mirror or lens, there must be a real entity emitting light on the other side."
--clerk Maxwell
Vector image
One way to describe an image is to use numbers to affirm the image's content, position, size, geometry--graphs: lines, curves, rectangles, circles, etc.; This image is called a vector graph.
Coordinates
For vector graphs, we need to define a coordinate system to describe it. The coordinate system used to describe the positional relationship of each element of the graph is called user space, in which the user defines the position of each element.
Figure 1-1 Coordinate system
The coordinate systems for all the examples in this article are as shown in the upper-left corner as the origin point to the right x-axis, and down to the y-axis.
Defining shapes
You can create a smiley face by using Bezier curves or circles. As follows:
Figure 1-2. Vector diagram
Draw Circle
Center 0.5, 0.5
RADIUS 0.4
Fill-color Yellow
Stroke-color Black
Stroke-width 0.05
Draw Circle
Center 0.35, 0.4
Radius 0.05
Fill-color Black
Draw Circle
Center 0.65, 0.4
Radius 0.05
Fill-color Black
Draw Line
Start 0.3, 0.6
End 0.7, 0.6
Stroke-color Black
Stroke-width 0.1
The upper-middle part of the description language is like a cookbook, which shows how to draw this graph, which contains some basic sets of graphs, such as line segments, curves, circles, these basic elements include color, relative size and position. When a picture is displayed, it needs to be converted to a bitmap , a process called rasterization . Vectors are resolution-independent, which means you can zoom in and out without worrying about image quality. Vector diagrams are generally used to represent fonts, logos, and many legends. (drawings used in AutoCAD are bitmaps)
Bitmap
Bitmap-Raster-is a "digital photograph", which is the most common format for expressing natural images and rich detail graphics. The bitmap describes how the image is stored in the computer's memory. The term "bitmap" refers to a pixel point that maps a particular color according to the given bit format.
Note that the graphic described in this article, including other chapters, refers to the bitmap
Figure 1-3 Raster Diagram
A rasterized letter "a" is magnified 16 times by using a pixel doubling method
Bitmaps store element values as arrays-one pixel of a graphic element, and pixels are related to the color of an image. Each horizontal line in the image is called a scan line .
The letter "A" depicted in Figure 3 can be represented by a 12x14 matrix that represents the light and shade of a pixel. The larger the value, the brighter the corresponding area.
Sampling
Measure the value of a pixel, taking the average of the color around that pixel point. A simple model is a square sample, called a Box filter (box filter), a more accurate measurement is to calculate a weighted Gaussian average (given pixel coordinates a dozen weights, and give it a lower weight around the value). Observing a bitmap, the human eye mixes all of the pixel values and creates an image of the successive images it represents.
Grating size
The number of sampled pixel points on a pixel square, either horizontal or vertical, is called a raster dimension, which is described as width x height.
Resolution
Resolution is the measurement of sample density, and the bitmap resolution represents the relationship between pixel size and physical size. The maximum unit of measurement used is the PPI, the number of pixels on a per-foot distance.
Fig. 1-4 Sampling Squares
The letter "A" is magnified 16 times after the raster format, using a circle to represent the pixel point.
Mega megapixel
Megapixel (megapixels) refers to the total number of pixels in an image, and a simple measure is the total number of horizontal and vertical sampling points in the sampled squares by the raster size. A 4:3-scale image with a size of 2048x1536, containing 2048x1535=3,145,728 pixels; close to 3 million, which is a 3 million-pixel image.
Table 1-1
Common Grating Dimensions
Dimensions |
Megapixels |
Name |
Comment |
640x480 |
0.3 |
Vga |
Vga |
720x576 |
0.4 |
CCIR 601 DV PAL |
Dimensions used for PAL DV, and pal DVDs |
768x576 |
0.4 |
CCIR 601 PAL Full |
PAL with square sampling grid ratio |
800x600 |
0.4 |
SVGA |
|
1024x768 |
0.8 |
XGA |
The currently (2004) most common computer-screen dimensions. |
1280x960 |
1.2 |
|
|
1600x1200 |
2.1 |
UXGA |
|
1920x1080 |
2.1 |
1080i HDTV |
Interlaced, high resolution digital TV format. |
2048x1536 |
3.1 |
2 K |
Typically used for digital effects in feature films. |
3008x1960 |
5.3 |
|
|
3088x2056 |
6.3 |
|
|
4064x2704 |
11.1 |
|
|
Scaling/resampling
Scale the original image when you need to create images of different sizes on existing bitmaps. Scaling is also called resampling (resampling), and the resampling algorithm attempts to reconstruct the original continuous image to obtain a new sampling grid.
Image reduction
The operation to reduce the size of the Guanshan is to reduce the sample rate (decimation), which can be obtained by averaging an output pixel on the source pixel point.
Image Amplification
When enlarging the size of the image, we want to create a sample point between the original raster sample points, which can be achieved by interpolating (interpolation) in the sampled squares-effectively guessing unknown pixel values.
Sample Depth
Pixel values need to be stored in the computer's memory, which means that the final image data is represented in binary form, and the spatial continuity of the image is approximated by the space between the sample points in the sampled squares. The value of each pixel we can represent is determined by the sampling format we choose.
Figure 1-5 Sample Depth
Change the sample depth of the same image, notice that the high-frequency region (more detailed area) than the low-frequency region to clear
8bit
A common sampling format is a 8bit integer, and a total of 8bit integers can represent 256 discrete values (2^8=256), and the light level (bfightness levels) is quantified to these levels.
12bit
For images with a higher dynamic range (images with details in the shadows and highlights), a total of 256 discrete values of 8bit cannot accurately store a precise image. Some digital cameras operate more than 8bit inside, and high-end cameras (SLRs) also provide original images (2^12bit=4096) that are usually 12bit
16bit
Graphics in PNG and TIF format support 16bit sampling, and many image processing programs typically press 16bit for 8bit images to avoid image distortion caused by program processing.
Float (floating point)
Some image formats for use in the film industry or for research can store floating-point values. 32-bit floating-point values that include "normal" and a special "half" format that uses 16 bits. Floating point is useful as a working format because the quantization and calculation errors in this process keep a smaller value from sampling to final rendering.
Floating-point representations typically include HDR, high dynamic range images. This image includes a sample value that is whiter than white (the 8bit bitmap has a value greater than 255). HDR allows for more precise representation of the illumination in a scene than Ldr.
(High dynamic Range Image: Provides more dynamic range and image detail than a normal image, using LDR images of different exposure times to synthesize the final HDR image with each exposure time relative to the best detail low-dynamic) [1], Can better reflect the visual effects in the real world. )
Color
The most common color model in computer graphics is the RGB color, which is the same way that CRT displays, LCD screens, and movie screens produce color. Each pixel point is represented by a red, green, and blue value. In this way, an RGB color image uses three times times as much memory as the grayscale image of the same pixel size.
Figure 1-6 RGB Color Band
A color image consisting of a red-green-blue band (this picture shows how the notebook display looks like, and it's important to note that this method is common in computer screens, not image printing).
This is the most common pixel format for cross-storage of 8bit RGB values in memory. This memory structure is often called Chunky, and another uncommon structure that stores different components in separate buffer is called planar.
Palette/Index Image
In the early days, images were often stored in a palette of patterns that worked in a way that wanted the brush of a digital strategy. We tightly store the corresponding numbers for each pixel's palette entry. For each palette entry, the corresponding red, green, and blue lights are stored.
Figure 1-7 Index Image
On the left, the image uses only 16 colors, and the right is the palette of the image.
Image compression
Bitmaps consume more memory, and image compression reduces the memory needed to store images. For example, a 2.1 million-megapixel 8bit RGB image (1600x1200) needs to occupy 1600x1200x3bytes = 5760000bytes = 5.5 megabytes memory, which is the size of an uncompressed image.
The compression ratio (xompression ratio) is the ratio of the size of the compressed graph to the original, and if the above image is stored as a JPEG file of 512KB, the storage scale is 0.5MB:5.5MB = 1:11.
Lossless compression
When the image is lossless compressed, less memory is used to repeat and predict the image information. The original image can be stored. One of the simplest lossless compression methods is the trip code (run-length encoding). This encoding stores successive identical values as a flag in the data stream.
Figure 1-8 Stroke coding
70,
5, 25,
5, 27,
4, 26,
4, 25,
6, 24,
6, 23,
3, 2, 3, 22,
3, 2, 3, 21,
3, 5, 2, 20,
3, 5, 2, 19,
3, 7, 2, 18,
3, 7, 2, 17,
14, 16,
14, 15,
3, 11, 2, 14,
3, 11, 2, 13,
3, 13, 2, 12,
3, 13, 2, 11,
3, 15, 2, 10,
3, 15, 2, 8,
6, 12, 6, 6,
6, 12, 6, 64
In Figure 1-8, the image of a house is compressed by the stroke encoding, which is considered to be a long string of black/white pixels encoded as a byte of the same color, one after the other. We can use 15 as the maximum span value to re-encode the values of those longer spans using the [0, 15] span values to further reduce the number of bytes consumed by these 72 numeric values.
70, 15, 0, 15, 0, 15, 0, 10,
5, 25, 5, 15, 0, 10,
5, 27, 6, 15, 0, 12,
4, 26, 4, 15, 0, 11,
4, 25, 4, 15, 0, 10,
6, 24, 6, 15, 0, 9,
6, 23, 6, 15, 0, 8,
3, 2, 3, 22, 3, 2, 3, 15, 0, 7,
3, 2, 3, 21, 3, 2, 3, 15, 0, 6,
3, 5, 2, 20, 3, 5, 2, 15, 0, 5,
3, 5, 2, 19, 3, 5, 2, 15, 0, 4,
3, 7, 2, 18, 3, 7, 2, 15, 0, 3,
3, 7, 2, 17, 3, 7, 2, 15, 0, 2
14, 16, 14, 15, 0, 1
14, 15, 14, 15,
3, 11, 2, 14, 3, 11, 2, 14,
3, 11, 2, 13, 3, 11, 2, 13,
3, 13, 2, 12, 3, 13, 2, 12,
3, 13, 2, 11, 3, 13, 2, 11,
3, 15, 2, 10, 3, 15, 2, 10,
3, 15, 2, 8, 3, 15, 2, 8,
6, 12, 6, 6, 6, 12, 6, 6,
6, 12, 6, 64 6, 12, 6, 15, 0, 15, 0, 15, 0, 15, 0, 4
The new encoding is 113nibble long. A nibble I 4bit can represent a value of 0-4, so we need 57 bytes to store all the values, which is much less than 93 bytes to store 1bit images. A bit less than 750 bytes--One byte to store one pixel. The travel encoding algorithm used in the file format may require additional methods to compress the RLE stream.
lossy image Compression
lossy compression uses the human eye to emphasize some information and weaken the characteristics of unimportant information. For example, the change in the human eye to light is more sensitive than the change in color.
JPEG is a file format that is compressed based on the discrete Cosine transform (DCT) and lossy compression algorithm, and it has a good compression ratio. JPEG works well for photos, logos, and scanned documents with continuous range. A graphic with sharp contours and lines is better than a photo's compression effect.
Loss through generations (offspring loss)
Because descendants accumulate losses, the lossy compression algorithm should not be used as an application format, but only the final version is stored in the JPEG format.
Figure 1-9 jpeg descendant loss
A special image is applied to the JPEG compression algorithm to save, repeatedly open and save 9 times in the loss of precision.
JPEG is suitable for the reverse effect of the compression algorithm is not very obvious in the photo.
JPEG is not intended for intermediate formats, only as a final picture of the file size being more cautious.
File formats and Applications
Many applications have their own built-in file formats, but other formats are better for passing data. The following table lists the common image formats
Table 1-2 Vector Chart format
Suffix name |
Name |
Description |
, A + |
Adobe Illustrator Document |
Native format of Adobe Illustrator (based on. eps format) |
. eps |
Encapsulated Postscript |
Industry standard format, including vector graphics for image printing |
. PS |
PostScript |
Vector graphic based on print language, applied to many laser printers, electronic papers for scientific research purposes |
. pdf |
Portable Document Format |
The modern version of PS is absorbed into the universal electronic print version |
. svg |
Scalable Vector Graphics |
XML based on the adoption of the standard absorption animation |
. swf |
ShockWave Flash |
Binary vector graphics format, with animations and sounds, most browsers support |
Table 1-3 Raster file formats
Suffix |
Name |
Description |
. jpg |
Joint Photographic Experts Group |
A lossy compression format widely used in photos |
. png |
Portable Network Graphics |
Lossless compression, supports 16bit sampling depth and alpha channel |
. gif |
Graphics Interchange Format |
8bit indexed bitmap format, except that animations have all been replaced by PNG format |
. EXR |
EXR |
HDR, high dynamic range format for the film industry |
. Raw |
Raw image File |
The memory data obtained directly from the digital camera, including images obtained from the graphics sensor without white-point processing and gamma correction. Different cameras use different suffixes, such as TIFF,.NEF,. RAF and. CRW |
. DGN |
Digital Negative |
Subclass of TIFF format, a standard format for storing raw files created by Adobe, used to exchange raw image data between apps |
. TIFF,. tif |
Tagged Image File Format |
|
. psd |
Photoshop Document |
Adobe Photoshop's native format, containing layers and other construction elements |
. SCF |
Gimp Project File |
Local image format for GIMP |
PPI and dpi differences: The difference between the two is that the pixel and dot pixels represent the value, and the point is a monochrome point, which can be a point of ink or the color of the printer's colorant. The printer creates a monochrome point format using a program called Half toning
When using the camera's digital magnification, the camera uses interpolation to guess the values that are not represented in the image. Images captured in the maximum magnification mode are then preprocessed on the computer, and cropping and zooming will get the same or better results.
Http://pippin.gimp.org/image_processing/chap_dir.html
The first chapter, the description of the digital image