Download presentation
Presentation is loading. Please wait.
Published byJens Stieber Modified over 5 years ago
1
Fundamentals of Image Processing Digital Image Representation
Chapter 2 Fundamentals of Image Processing Digital Image Representation An image continuous with respect to the x- and y-coordinates, and also in amplitude. Converting such an image to digital form requires that the coordinates, as well as the amplitude, be digitized. Digitizing coordinates values is called sampling. Digitizing amplitude values is called quantization. Thus, when x, y, and the amplitude values of f are all finite, discrete quantities, we call the image a digital image. ---- © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
2
Fundamentals of Image Processing Coordinate conventions
Chapter 2 Fundamentals of Image Processing Coordinate conventions The result of sampling and quantization is a matrix of real numbers. Assume that an image f(x,y) is sampled so that the resulting image has M rows and N columns. We say that the image is of size M x N. The image origin is defined to be at (x, y)=(0, 0). The next coordinate value along the first row of the image are (x, y)= (0, 1). Note that x ranges from 0 to M-1, and y ranges from 0 to N-1 in integer increments © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
3
Fundamentals of Image Processing Coordinate conventions
Chapter 2 Fundamentals of Image Processing Coordinate conventions Image processing reference Image processing toolbox © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
4
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing Images as Matrices Each element of the image array is called an image element, picture element, pixel or pel. The image can be represent for a digitized image function: © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
5
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing Images as Matrices A digital image can be represented naturally as a MATLAB matrix: Where f(1,1) = f (0,0) Note that the 1xN matrix is called a row vector, whereas the Mx1 matrix is called a column vector. And a 1x1 matrix is called a scalar. © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
6
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing Reading, Writing and Displaying images Followings are the image/graphics formats supported by MATLAB image processing reading and writing functions © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
7
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing Reading images Images are read into MATLAB environment using function imread. imread(‘filename) Here, filename is a string containing the complete name of the image file. For ex: >> f = imread(‘moon.tif’); >>f1 = imread(‘c:\my doc\xyz.jpg’); The above stmt reads the image moon.tif into image array f. Function size( ) gives the row & column dimensions of an image >> size(f) ans= © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
8
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing Displaying images Images are displayed on the MATLAB desktop using function imshow( ) , which has the basic syntax: imshow(f, G) Where f is an image array, and G is the number of intensity level used to display it. If G is omitted, it defaults to 256 levels. >> imshow(f); And one more function can use to display the images on MATLAB desktop >> imview(f); © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
9
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing Writing Images Images are written into disk using function imwrite, which has the following syntax: >> imwrite(f, ‘filename’); The string contained in the filename must include a recognized file format extension. Alternatively the desired format can be specified explicitly with a third input argument. For example the following command writes f to a TIFF file named xyz. >> imwrite(f, ‘xyz’, ‘tif’); or Alternatively >> imwrite(f, ‘xyz.tif’); © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
10
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing Data Classes In MATLAB and IPT, following data classes are supported for representing a pixel value. © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
11
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing Image Types MATLAB and IPT supports four type of images. Intensity images Binary Images Indexed images RGB images © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
12
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing Intensity Images An intensity image is a data matrix whose value have been scaled to represent intensities. When the element of an intensity image are of class unit8, or class unit16, they have integer value in the range of [0, 255] and [0, 65535] respectively. If the image is of class double, the values are of floating point numbers. Values of scaled, class double intensity images are in range [0,1] by conventions. © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
13
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing Binary Images Binary images having very specific meaning in MATLAB. A binary image is a logical array of 0s and 1s. Thus an arrays of 0s and 1s whose values are of data class, say, unit8, is not considered a binary image in MATLAB. Thus, if A is a numeric array consisting of 0s and 1s, we create a logical array B using the statement. B= logical(A); © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
14
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing Indexed Images An indexed image consists of a data matrix, X, and a colormap matrix, map. map 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. The value 1 points to the first row in map, the value 2 points to the second row, and so on. You can display an indexed image with the statements © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
15
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing RGB Images An RGB image, sometimes referred to as a "truecolor" image, is stored in MATLAB as an m-by-n-by-3 data array that defines red, green, and blue color components for each individual pixel. RGB images do not use a palette. 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 RGB 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 nickname "truecolor image." © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
16
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing Conversion between data classes to image types. The toolbox provide specific functions that perform the scaling necessary to convert between image classes and types. © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
17
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing Conversion between data classes to image types. Few more Image conversions may possible: 1) rgb2gray 2) im2bw 3) rgb2ind 4) ind2gray 5) ind2rgb © Dept. of Computer Science, Swami Vivekanand Mahavidyalay, Udgir (Mah)
18
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing M-File Element Description Function definition line functions only Defines the function name, and the number and order of input and output arguments H1 line A one line summary description of the program, displayed when you request help on an entire directory, or when you use lookfor Help text A more detailed description of the program, displayed together with the H1 line when you request help on a specific function Function or script body Program code that performs the actual computations and assigns values to any output arguments Comments Text in the body of the program that explains the internal workings of the program
19
Fundamentals of Image Processing
Chapter 2 Fundamentals of Image Processing Basic Parts of an M-File This simple function shows the basic parts of an M-file. Note that any line that begins with % is not executable: function f = fact(n) Function definition line % Compute a factorial value. H1 line % FACT(N) returns the factorial of N, Help text % usually denoted by N! % Put simply, FACT(N) is PROD(1:N) Comment f = prod(1:n); Function body
20
Arithmetic Operators The arithmetic operators have M-file function equivalents, as shown: Binary addition A+B plus(A,B) Unary plus +A uplus(A) Binary subtraction A-B minus(A,B) Unary minus -A uminus(A) Matrix multiplication A*B mtimes(A,B) Arraywise multiplication A.*B times(A,B) Matrix right division A/B mrdivide(A,B) Arraywise right division A./B rdivide(A,B) Matrix left division A\B mldivide(A,B) Arraywise left division A.\B ldivide(A,B) Matrix power A^B mpower(A,B) Arraywise power A.^B power(A,B) Complex transpose A‘ ctranspose(A) Matrix transpose A.‘ transpose(A)
21
Image Arithmetic Functions
The following table lists the image arithmetic functions. For more complete descriptions, see their reference pages. Function Description imabsdiff Absolute difference of two images imadd Add two images imcomplement Complement an image imdivide Divide two images imlincomb Compute linear combination of two images immultiply Multiply two images imsubtract Subtract two images
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.