Easy way to start a MATLAB program - Digital Image Processing

The MATLAB program is initiated by three lines indicating to clear the command window,workspace containing variables and the figure window if it is left open previously.

The codes are as follows:

warning off;
clc;
clear all;
close all;
 Here, "clc" clears the command window 
             "clear all " clears the workspace 
              "close all" clears the figure window
“warning off” indicates no warning generation

MATLAB code to read different images  such as grayscale,rgb,index and binary from MATLAB Library

We can read different types of images like grayscale,colour,binary image and index images in MATLAB through the inbuilt function “imread”. At first, we should clear the command window,workspace containing variables and the figure window if it was left open previously.

Matlab code:

%% Reading Images
warning off;
clc;
clear all;
close all;
 
I1=imread('image.jpg');    	%Grayscale image
I2=imread('colourimage.jpg'); 	%colour image
I3=imread('binaryimage.jpg'); 	%binary image
[I4,map]=imread('trees.tif'); 	%index image

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.