Basic Image Processing Using MATLAB

By Ismail Taibani

- Advertisement -

efy testedIn this article, the author describes basic image processing using MATLAB software.

MATLAB is a high-performance language for technical computing with powerful commands and syntax. It is used for many purposes like Maths and computation, data analysis, algorithm development, modelling stimulation and prototyping. Edge detection, noise and image histogram modelling are some important and basic topics in image processing.

Image processing using MATLAB

Edge detection

An image is nothing but mapping of intensity of the light reflecting from a scene captured from a camera, and edges are the discontinuity of the scene intensity function. We can detect these edges using MATLAB commands. There are many methods for edge detection such as Robert’s operator, Prewitt operator, Sobel operator, Canny edge detector and so on. Fig. 1 shows edge detection using these operators on cameraman.tif standard image available in MATLAB.

Edge detection using various operators
Fig. 1: Edge detection using various operators


- Advertisement -

Noise in any system is unwanted. In image processing, noise in a digital image arises during image acquisition and also during transmission. Different types of noise include speckle, Gaussian, salt-and-pepper and more. The fun part is, we can use these types of noise as special effects in an image using MATLAB.

Special effects in an image using different types of noise
Fig. 2: Special effects in an image using different types of noise

Fig. 2 shows the results of different types of noise added to an image. In this image, RGB-to-gray conversion is done first and then different types of noise are added in the image through the program. All operations are included in MATLAB program.

Histogram modelling

A histogram of an image provides a vast description about an image. It represents the occurrence of various gray levels relative to the frequencies. In this program, we plot the histogram of the original image and of the histogram-equalised image.

Histogram modelling image processing using MATLAB
Fig. 3: Histogram modelling


Running the program is straightforward. There are three .m files, one each for edge detection, noise effects and histogram. Two image files (.jpeg) are also included along with these .m files in the same folder. Launch MATLAB R2013a from your desktop and open an .m file from C:\Users\SONY\Desktop folder to run the program.

Image processing is a diverse and the most useful field of science, and this article gives an overview of image processing using MATLAB. There are many more topics that are useful and can be applied using MATLAB or OpenCV library such as erosion, dilation, thresholding, smoothing, degradation and restoration, segmentation part like point processing, line processing and edge detection (covered here) of images.

Download source code: click here

Ismail Taibani is a technology enthusiast from Byculla

This article was first published on 18 October 2016 and was recently updated on 28 December 2018.


    • There are lots of good books on Image processing with MATLAB code. I used a book written by Rafael Gonzales and R. Woods, called “Digital Image Processing using Matlab”. It has a lot of details, both theoretical and practical.

  1. Hello Moderator,

    Please am new in the area of image processing research.

    Please kindly can you provide me with codes of the below IQAs in image processing evaluation
    IWSSIM,VIF,MAD,FSIM,GSIM,GMSD,VSI and SCQI and any other relevant ones you have access to.

    Am working on Image processing evaluation approach using the IQA models available.

    Thank you in advance.

  2. Hey Ismail,
    Thanks for suggesting amazing ideas for MATLAB projects, it would be great for me if you share some projects or tasks related to Non-Fused Switch Disconnectors. I want to do something creative using this amazing tool.
    Keep sharing such amazing information.



What's New @

Most Popular DIYs

Electronics Components

Truly Innovative Tech