In this series of four articles, fundamentals as well as advanced topics of image processing using MATLAB are discussed. The articles cover basic to advanced functions of MATLAB’s image processing toolbox (IPT) and their effects on different images. Part I in this series gives a brief introduction to digital images and MATLAB followed by basic image processing operations in MATLAB including image reading, display and storage back into the disk.
Image processing
Image processing is the technique to convert an image into digital format and perform operations on it to get an enhanced image or extract some useful information from it. Changes that take place in images are usually performed automatically and rely on carefully designed algorithms.
Image processing is a multidisciplinary field, with contributions from different branches of science including mathematics, physics, optical and electrical engineering. Moreover, it overlaps with other areas such as pattern recognition, machine learning, artificial intelligence and human vision research. Different steps involved in image processing include importing the image with an optical scanner or from a digital camera, analysing and manipulating the image (data compression, image enhancement and filtering), and generating the desired output image.
The need to extract information from images and interpret their content has been the driving factor in the development of image processing. Image processing finds use in numerous sectors, including medicine, industry, military, consumer electronics and so on.
In medicine, it is used for diagnostic imaging modalities such as digital radiography, positron emission tomography (PET), computerised axial tomography (CAT), magnetic resonance imaging (MRI) and functional magnetic resonance imaging (fMRI). Industrial applications include manufacturing systems such as safety systems, quality control and automated guided vehicle control.
In medicine, it is used for diagnostic imaging modalities such as digital radiography, positron emission tomography (PET), computerised axial tomography (CAT), magnetic resonance imaging (MRI) and functional magnetic resonance imaging (fMRI). Industrial applications include manufacturing systems such as safety systems, quality control and automated guided vehicle control.
Complex image processing algorithms are used in applications ranging from detection of soldiers or vehicles, to missile guidance and object recognition and reconnaissance. Biometric techniques including fingerprinting, face, iris and hand recognition are being used extensively in law enforcement and security.
Digital cameras and camcorders, high-definition TVs, monitors, DVD players, personal video recorders and cell phones are popular consumer electronics items using image processing.
MATLAB
MATLAB, an abbreviation for ‘matrix laboratory,’ is a platform for solving mathematical and scientific problems. It is a proprietary programming language developed by MathWorks, allowing matrix manipulations, functions and data plotting, algorithm implementation, user interface creation and interfacing with programs written in programming languages like C, C++, Java and so on.
In MATLAB, the IPT is a collection of functions that extends the capability of the MATLAB numeric computing environment. It provides a comprehensive set of reference-standard algorithms and workflow applications for image processing, analysis, visualisation and algorithm development.
It can be used to perform image segmentation, image enhancement, noise reduction, geometric transformations, image registration and 3D image processing operations. Many of the IPT functions support C/C++ code generation for desktop prototyping and embedded vision system deployment.
What is a digital image?
A digital image may be defined as a two-dimensional function f(x,y), where ‘x’ and ‘y’ are spatial coordinates and the amplitude of ‘f’ at any pair of coordinates is called the intensity of the image at that point. When ‘x,’ ‘y’ and amplitude values of ‘f’ are all finite discrete quantities, the image is referred to as a digital image.
Digitising the coordinate values is referred to as ‘sampling,’ while digitising the amplitude values is called ‘quantisation.’ The result of sampling and quantisation is a matrix of real numbers.
A digitised image is represented as:
Each element in the array is referred to as a pixel or an image element.
Basic image processing commands in MATLAB
In MATLAB a digital image is represented as:
In this representation, you can notice the shift in origin.
Reading images
Images are read in MATLAB environment using the function ‘imread.’ Syntax of imread is:
imread(‘filename’);
where ‘filename’ is a string having the complete name of the image, including its extension.
For example,
>>F = imread(Penguins_grey.jpg);
>>G = imread(Penguins_RGB.jpg);
>>G = imread(Penguins_RGB.jpg);
Please note that when no path information is included in ‘filename,’ ‘imread’ reads the file from the current directory. When an image from another directory has to be read, the path of the image has to be specified.
Semicolon (;) at the end of a statement is used to suppress the output. If it is not included, MATLAB displays on the screen the result of the operation specified in that line.
‘>>’ indicates the beginning of a command line as it appears in the MATLAB command window.
Fig. 1: Grayscale image of penguins
Fig. 2: RGB image of penguins
Figs 1 and 2 show grayscale and RGB images of penguins, respectively. These images can be downloaded from the EFY website and stored in the current working directory.
imread, imshow and imwrite functions in MATLAB are used to read images in MATLAB environment, display them on MATLAB desktop and write them to the current directory, respectively
No comments:
Post a Comment