27-07-2012, 03:26 PM
Image Processing
CHAPTER 1 Image Processing.docx (Size: 3.67 MB / Downloads: 37)
1.1 Image:
A digital image is a computer file that contains graphical information instead of text or a program. Pixels are the basic building blocks of all digital images. Pixels are small adjoining squares in a matrix across the length and width of your digital image. They are so small that you don’t see the actual pixels when the image is on your computer monitor.
Pixels are monochromatic. Each pixel is a single solid color that is blended from some combination of the 3 primary colors of Red, Green, and Blue. So, every pixel has a RED component, a GREEN component and BLUE component. The physical dimensions of a digital image are measured in pixels and commonly called pixel or image resolution. Pixels are scalable to different physical sizes on your computer monitor or on a photo print. However, all of the pixels in any particular digital image are the same size. Pixels as represented in a printed photo become round slightly overlapping dots.
Pixel Values: As shown in this bitonal image, each pixel is assigned a tonal value, in this example 0 for black and 1 for white.
PIXEL DIMENSIONS are the horizontal and vertical measurements of an image expressed in pixels. The pixel dimensions may be determined by multiplying both the width and the height by the dpi. A digital camera will also have pixel dimensions, expressed as the number of pixels horizontally and vertically that define its resolution (e.g., 2,048 by 3,072). Calculate the dpi achieved by dividing a document's dimension into the corresponding pixel dimension against which it is aligned.
dimensions of 2,400 pixels (8" x 300 dpi) by 3,000 pixels (10" x 300 dpi).
1.2 : Images in MATLAB:
The basic data structure in MATLAB is the array, an ordered set of real or complex elements. This object is naturally suited to the representation of images, real-valued ordered sets of color or intensity data.
MATLAB stores most images as two-dimensional arrays (i.e., matrices), in which each element of the matrix corresponds to a single pixel in the displayed image. (Pixel is derived from picture element and usually denotes a single dot on a computer display.)
For example, an image composed of 200 rows and 300 columns of different colored dots would be stored in MATLAB as a 200-by-300 matrix. Some images, such as color images, require a three-dimensional array, where the first plane in the third dimension represents the red pixel intensities, the second plane represents the green pixel intensities, and the third plane represents the blue pixel intensities. This convention makes working with images in MATLAB similar to working with any other type of matrix data, and makes the full power of MATLAB available for image processing applications.
1.3 : Types of Images:
IMAGE REPRESENTATION
An image is stored as a matrix using standard Matlab matrix conventions. There are four basic types of images supported by Matlab:
1. Binary images
2. Intensity images
3. RGB images
4. Indexed images
Binary Images:
In a binary image, each pixel assumes one of only two discrete values: 1 or 0. A binary image is stored as a logical array. By convention, this documentation uses the variable name BW to refer to binary images.
The following figure shows a binary image with a close-up view of some of the pixel values.
Grayscale Images:
A grayscale image (also called gray-scale, gray scale, or gray-level) is a data matrix whose values represent intensities within some range. MATLAB stores a grayscale image as an individual matrix, with each element of the matrix corresponding to one image pixel. By convention, this documentation uses the variable name I to refer to grayscale images.
The matrix can be of class uint8, uint16, int16, single, or double. While grayscale images are rarely saved with a color map, MATLAB uses a color map to display them.
For a matrix of class single or double, using the default grayscale color map, the intensity 0 represents black and the intensity 1 represents white. For a matrix of type uint8, uint16, or int16, the intensity intmin (class (I)) represents black and the intensity intmax (class (I)) represents white.
The figure below depicts a grayscale image of class double.
Color Images:
A color image is an image in which each pixel is specified by three values — one each for the red, blue, and green components of the pixel's color. MATLAB store color images as an m-by-n-by-3 data array that defines red, green, and blue color components for each individual pixel. Color images do not use a color map. The color of each pixel is determined by the combination of the red, green, and blue intensities stored in each color plane at the pixel's location.
Graphics file formats store color images as 24-bit images, where the red, green, and blue components are 8 bits each. This yields a potential of 16 million colors. The precision with which a real-life image can be replicated has led to the commonly used term color image.
A color array can be of class uint8, uint16, single, or double. In a color array of class single or double, each color component is a value between 0 and 1. A pixel whose color components are (0, 0, 0) is displayed as black, and a pixel whose color components are (1, 1, 1) is displayed as white. The three color components for each pixel are stored along the third dimension of the data array. For example, the red, green, and blue color components of the pixel (10,5) are stored in RGB(10,5,1), RGB(10,5,2), and RGB(10,5,3), respectively.
The following figure depicts a color image of class double.
Indexed Images:
An indexed image consists of an array and a colormap matrix. The pixel values in the array are direct indices into a colormap. By convention, this documentation uses the variable name X to refer to the array and map to refer to the colormap.
The colormap matrix is an m-by-3 array of class double containing floating-point values in the range [0, 1]. Each row of map specifies the red, green, and blue components of a single color. An indexed image uses direct mapping of pixel values to colormap values. The color of each image pixel is determined by using the corresponding value of X as an index into map.
A colormap is often stored with an indexed image and is automatically loaded with the image when you use the imread function. After you read the image and the colormap into the MATLAB workspace as separate variables, you must keep track of the association between the image and colormap. However, you are not limited to using the default colormap--you can use any colormap that you choose.
The relationship between the values in the image matrix and the colormap depends on the class of the image matrix. If the image matrix is of class single or double, it normally contains integer values 1 through p, where p is the length of the colormap. The value 1 points to the first row in the colormap, the value 2 points to the second row, and so on. If the image matrix is of class logical, uint8 or uint16, the value 0 points to the first row in the colormap, the value 1 points to the second row, and so on.
The following figure illustrates the structure of an indexed image. In the figure, the image matrix is of class double, so the value 5 points to the fifth row of the colormap