Reading Images

Images are read into the MATLAB environment using function imread, whose basic syntax is :

imread( 'filename')

Here, filename is a string containing the complete name of the image file (including any applicable extension). For example, the statement.

>> a = imread('Desert.jpg');

reads the image from the JPEG file chestxray into image array f. Note the use of single quotes (‘) to delimit the string filename . The semicolon at the end of a statement is used by MATLAB for suppressing output. If a semicolon is not included, MATLAB displays on the screen the results of the operation( s)specified in that line. The prompt symbol (ยป) designates the beginning of a command line, as it appears in the MATLAB Command Window.

Read an Image from windows absolute path

simplest way to read an image from a specified directory is to include a full or relative path to that directory in filename. For example :

>> a = imread('D:\matlabPractice\Desert.jpg');

Displaying Images

To show the already read image we can simply use imshow() function as :

>> imshow(a);