0% found this document useful (0 votes)
8 views

Image Processing Using Matlab: Practical 1

This document provides instructions for reading, displaying, and adjusting the contrast of images using MATLAB. It explains how to use commands like imread to read an image file into a variable, imshow to display the image, and imtool or imadjust to interactively adjust the contrast. It also demonstrates how to programmatically improve contrast using commands like histeq and imhist, and how to save a modified image back to disk with imwrite.

Uploaded by

nandkishor joshi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Image Processing Using Matlab: Practical 1

This document provides instructions for reading, displaying, and adjusting the contrast of images using MATLAB. It explains how to use commands like imread to read an image file into a variable, imshow to display the image, and imtool or imadjust to interactively adjust the contrast. It also demonstrates how to programmatically improve contrast using commands like histeq and imhist, and how to save a modified image back to disk with imwrite.

Uploaded by

nandkishor joshi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Image processing using matlab

Practical 1
Read and Display an Image
close all
This command clears the MATLAB workspace
of any variables and close open figure
windows.
I = imread('pout.tif');
This command reads one of the sample images
included with the toolbox, pout.tif, and stores
it in an array named I. pout.tif is a grayscale
image.
Read and Display an Image
imshow(I)
This command is used to display an image.
See different functions in figure window:
Go to axis properties in edit. Figure will open with
axis window. Check functions of different options
available in axis prop.
whos
This command gives information about variables in
the workspace
Adjusting Image Contrast Using the
Adjust Contrast Tool
Imtool command
imtool('pout.tif')
This command is used to View an image in the
Image Tool
In this window, use adjust contrast button to
change contrast of the image.
Change min , max, width and centre in the
adjust contrast window and see its effect on
the image.
Adjust contrast
See effect of other tools on the image

Navigate function
Inspect pixel value
Measure distance
Display image information
Adjust contrast
Crop image
Zoom in
Zoom out
Adjust contrast
Drag image to pan
Adjust contrast/brightness via mouse motion
Choose colormap

Imcontrast command
imshow('pout.tif')
imcontrast(gca)
imadjust command
I = imread('pout.tif');
J = imadjust(I);
imshow(I), figure, imshow(J)
Command figure is used to prevent overlapping
of 2nd image over 1st image.
Improve image contrast
I = imread('pout.tif');
imshow(I)
figure, imhist(I)
I2 = histeq(I);
figure, imshow(I2)
Write the Image to a Disk File
imwrite (I2, 'pout2.png');
To see what imwrite wrote to the disk file, use
the imfinfo function.
imfinfo('pout2.png')

You might also like