You are on page 1of 3

IMAGE PROCESSING

COMMANDS IN MATLAB

Multiphase Flow & Heat Transfer


(MFHT)
Submitted To: Dr. Alam Nawaz Khan
Lecture Date: 18/04/2016
Submitted By: Zahoor Hussain
(11-6-1-031-2014)

APRIL 18, 2016


DEPARTMENT OF CHEMICAL ENGINEERING
Pakistan Institute of Engineering & Applied Sciences, Islamabad

MATLAB Commands
>> a = imread('filename.extension')
>> whos
>>figure, imshow(a)

>> b = rgb2gray(a);

Reads the file from directory and stores in


variable a
Tells the name, size and bytes the picture
occupies
Shows the picture

>> figure, imshow(b)

Converts the picture from RBG to gray


scale (range from 0-255) and stores the
gray pic in variable named as b
Shows the gray picture

>> figure, imhist(b)

Shows the histogram ranging from 0-250

>> c = imadjust(b)
>> subplot(1,2,1), imhist(b)
>> subplot(1,2,2), imhist(c)

>> d = graythresh(b)

Adjusts the contrast and stores in c


These two histograms in one window
appeared have different contrasts

That can be used to convert an intensity


image to a binary image. c is a normalized
intensity value that lies in the range [0, 1]

>> max(b)
>> max(max(b))

Maximum value in gray scale image (0)

>> min(min(b))

Minimum value in gray scale image (255)

>> mean(mean(b))

Mean value of gray scale image

>> im2bw(b)

Similar effect as of adjust command


(converts to binary image)

You might also like