Knowledge Base

MATLAB® and Digital Image Processing

It is said that a picture is worth a thousand words, and this adage is true in many fields. The first and foremost field that comes to the mind is the medical sector. The introduction of digital image processing (DIP) like X-ray imaging, PET scan, CT scan, helped doctors and surgeons  understand the underlying cause better, and helped in improving diagnosis and treatment due to enhanced detailing of the images.  In the automobile sector, image processing is an important part of autonomous driving technology as well; enabling AI equipped cars to comprehend ambient surroundings better, even in adverse weather conditions. It is equally useful in military surveillance too. Apart from such use, image processing is also used for pattern recognition, video processing, remote sensing, transmission and encoding, machine / robot vision, radio astronomy, microscopic imaging and many other fields.

Technology behind DIP
The conversion of images from analog to digital involves massive amounts of data. Just as an example, sampling an image on a 1024 x 1024 grid, where each picture element is quantized to 10 bits, results in a data array of over 10 million bits. There are a number of digital image processing algorithms that exist today to convert such analog images to their digital form, and also for image enhancement, restoration, detection and estimation, reconstruction, data compression, spectral estimation, and analysis. Implementing them requires sophisticated math software.

So, how does digital image processing work? The key in understanding the technology behind DIP is that what the human eye perceives an image – which is a coherent set of data bunched together – is simply a cluster of pixels to computers. In order to make sense of these pixels, computers need to decipher what the pixels mean, before trying to enhance the image. In mathematical terms, which is the language computers understand, an image is a 2D function f (x, y), where x and y are spatial (planar) co-ordinates. The amplitude of f at any pair of x and y co-ordinates is called the intensity or gray level of the image at that point. When all three (x, y, and f) are finite and discrete quantities, the image generated is called a digital image. A digital image is composed of a finite number of elements, each of which has a particular location and value. Each of these discrete elements is called a pixel. Image processing involves the transformation of a 2D image to its pixel form, and performing certain mathematical operations on it in order to enhance its utility. This task is accomplished by algorithms.  And as processer capabilities have expanded, newer algorithms are being developed that take advantage of these capabilities. However, to implement these algorithms, powerful math software is needed. And this is where MATLAB comes in handy.

Introduction to MATLAB
MATLAB has been developed by MathWorks, a leading developer of mathematical computing software. It is the same company that also develops Simulink. Both the products are renowned worldwide and trusted by engineers and scientists worldwide to accelerate the pace of discovery, innovation, and development. MATLAB is a standard computational tool for introductory as well as advanced courses in math in schools and colleges. The industry uses MATLAB for research, analysis and development. MATLAB covers domains like Data Analysis, Graphics, Programming, App Building and Parallel Computing. The MATLAB language (which is a proprietary language), is dedicated to matrix calculations and has been optimized with this perspective. MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation. Apart from math, MATLAB is useful in algorithm development, modelling, simulation, and prototyping, data analysis and data visualization.

One of the most salient features of MATLAB is that it has a huge library of built-in functions. These functions can be called using the MATLAB language. The MATLAB software can be used in two ways: by direct execution of the commands typed in the command window or by the execution of programs. It is available for Windows, Mac and Linux OS.

MATLAB and Digital Image Processing
The applications used by a digital computer to process digital images via an algorithm are known as Digital image processing. The captured image is then used in executing computer functions to derive an enriched version of the same or obtain the desired information from it. Digital image processing algorithms can be used to:

  • Convert signals from an image sensor into digital images
  • Improve clarity, and remove noise and other artifacts
  • Extract the size, scale, or number of objects in a scene
  • Prepare images for display or printing
  • Compress images for communication across a network

MATLAB also provides a wide range of application specific solutions called toolboxes. One such toolbox is the Image Processing Toolbox (IPT), which is MATLAB’s solution for image processing. The MATLAB IPT is a collection of MATLAB functions (called M-functions or M-files) that extend the capability of the MATLAB environment specifically to provide solution of digital image processing problems. The MATLAB Image Processing Toolbox software defines several fundamental types of images, and their type determines the way MATLAB interprets array elements as pixel intensity values. In addition, the IPT provides a comprehensive set of reference-standard algorithms and workflow apps for image processing, analysis, visualization, and algorithm development that allow users to perform image segmentation, image enhancement, noise reduction, geometric transformations, image registration, and 3D image processing. It lets you automate common image processing workflows, and users can interactively segment image data, compare image registration techniques, and batch-process large data sets. Visualization functions and apps let users explore images, 3D volumes, and videos; adjust contrast; create histograms; and manipulate Regions of Interest (ROIs). Some of these functions are written in the MATLAB language, while others are written in machine language, for reasons of execution speed.

Users can combine MATLAB and IPT functions with programming constructs to generate solutions that expand the capabilities of those functions in order to solve a broad spectrum of image-processing problems, making it a popular choice of software for image digitization. However, MATLAB is not used only for image processing. You can learn more about its computational capabilities here.