Complement Image using MATLAB Image Processing

Complement Image using MATLAB Image Processing.

Hi, In my previous post about we discussed how to create discrete wave sequences from the continuous signals in Matlab. Well those things are particularly used in Digital Signal Processing, but in this post i want to discuss something related to Digital Image Processing.

As you can see from the title, in this post we are going to learn how to complement a given image using MATLAB. Basically we will be doing a simple image processing.

You might know what is complementing that is in simple binary form, we get 0’s for 1’s and 1’s for 0’s. So similar to this concept, while complementing an image we convert dark regions to light and light regions to dark.

So before doing this work, follow few steps:

  1. Get the image you want to process
  2. Rename it as pic1 (JPG format) (This is because we are using ‘pic1’ as the name in the MATLAB program. Or else you can also change the file name in the Matlab program itself with the actual name of your picture along with its format like ‘.JPG’, ‘.PNG’, etc)
  3. Now copy and the paste the following code in a ‘m file’ and run the program.

The code is as follows:

clear all
pic1 = imread('pic1.jpg');

pic2 = imcomplement(pic1);

Complementing image using MATLAB
If you have any difficulty understanding the code or implementing it, then you can comment below or you can contact me via my contact page or facebook or twitter.

Content is copyrighted © www.123mylist.com