Basic Image Processing Using MATLAB

By Ismail Taibani


In 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.

Fig. 1: Edge detection using various operators


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.

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.

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.

      • hi ismail, how are you?
        will you plz help me?
        i need a project for my subject digital image processing on matlab?
        on matlab coding or document
        will you please provide me source code and documentation?

  1. can u please give the source code of matlab for image processing to from a image ” how many persons,male or female,age,dress what they wear etc

  2. Can you provide the source code for evaluation of Biosecure DS2: A Score-level Quality-dependent and Cost-sensitive Multimodal Test Bed.

  3. please i need a good mathlab book i have my search on diognostic diabatic patiants by teaching eye image using matlab software

  4. Can you tell me the any book or other material so that I can learn images processing in Matlab completely from basic.

  5. our company is involved in implementing image processing solutions for industrial applications .we would like to purchase technology of image processing. can u suggest us something?

  6. 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.

  7. 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.

  8. pls share the matlab code for face alignment,facial landmark detection and feature extraction using COSFIRE filter and SURF Descriptor and applying svm classifier for my final year project.

  9. can you please help me out with this project of mine:certain indigenous vegetable leaf recognition using matlab,the algorithms and the code for the project.thanks

  10. Hii..
    Can you please provide source code to implement a fuzzy filter to remove Gaussian noise with different standard deviations.


Please enter your comment!
Please enter your name here