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

Basic Image Import, Processing, and Export - MATLAB & Simulink - MathWorks India

The document discusses importing an image file into MATLAB, adjusting the image contrast through histogram equalization, and exporting the adjusted image to a new file. Specifically, it loads a TIFF image, calculates its histogram to find it has low contrast, equalizes the histogram to improve contrast, then saves the equalized image as a PNG file.

Uploaded by

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

Basic Image Import, Processing, and Export - MATLAB & Simulink - MathWorks India

The document discusses importing an image file into MATLAB, adjusting the image contrast through histogram equalization, and exporting the adjusted image to a new file. Specifically, it loads a TIFF image, calculates its histogram to find it has low contrast, equalizes the histogram to improve contrast, then saves the equalized image as a PNG file.

Uploaded by

rajivsharma1610
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Basic Image Import, Processing, and Export - MATLAB & Simulink - M...

http://in.mathworks.com/help/images/image-import-and-export.html#z...

, Processing, and Export

mage into the workspace, adjust the contrast in the image, and then write the adjusted

bles and close open figure windows.

imread command. The example reads one of the sample images included with the

le named pout.tif , and stores it in an array named I . imread infers from the file that the

le Format (TIFF).

nction. You can also view an image in the Image Viewer app. The imtool function opens

an integrated environment for displaying images and performing some common image
pp provides all the image display capabilities of imshow but also provides access to several
images, such as scroll bars, the Pixel Region tool, Image Information tool, and the

ars in the Workspace

the image data in the workspace, using the whos command. You can also check the

1 of 5

03-Jun-15 3:55 PM

Basic Image Import, Processing, and Export - MATLAB & Simulink - M...

http://in.mathworks.com/help/images/image-import-and-export.html#z...

function returns the image data in the variable I , which is a 291-by-240 element

CONTENTS

Bytes

Class

69840

uint8

Close

Attributes

ensities. The image pout.tif is a somewhat low contrast image. To see the distribution of

gram by calling the imhist function. (Precede the call to imhist with the figure command
e the display of the image I in the current figure window.) Notice how the histogram

image is rather narrow. The range does not cover the potential range of [0, 255], and is
ould result in good contrast.

histeq function. Histogram equalization spreads the intensity values over the full

(The toolbox includes several other functions that perform contrast adjustment, including
active tools such as the Adjust Contrast tool, available in the Image Viewer.)

2 of 5

03-Jun-15 3:55 PM

Basic Image Import, Processing, and Export - MATLAB & Simulink - M...

CONTENTS

http://in.mathworks.com/help/images/image-import-and-export.html#z...

Close

e a histogram of the equalized image I2 . If you compare the two histograms, you can see

d out over the entire range than the histogram of I .

3 of 5

03-Jun-15 3:55 PM

Basic Image Import, Processing, and Export - MATLAB & Simulink - M...

CONTENTS

http://in.mathworks.com/help/images/image-import-and-export.html#z...

Close

a Disk File
disk file, using the imwrite function. This example includes the filename extension
function writes the image to a file in Portable Network Graphics (PNG) format, but you

ewly Written File

e, using the imfinfo function. The imfinfo function returns information about the image
h, and height.

4 of 5

03-Jun-15 3:55 PM

Basic Image Import, Processing, and Export - MATLAB & Simulink - M...

CONTENTS

http://in.mathworks.com/help/images/image-import-and-export.html#z...

Close

/tmp/Bdoc15a_200152_161220/tpf05ecb51_9f0a_4e...'
23-Feb-2015 09:38:29'

grayscale'
137 80 78 71 13 10 26 10]

23 Feb 2015 14:38:29 +0000'

5 of 5

03-Jun-15 3:55 PM

You might also like