Lecture - 3 - Image - Processing - Toolbox - IPT - Matlab
Lecture - 3 - Image - Processing - Toolbox - IPT - Matlab
Qadri Hamarsheh
1
Dr. Qadri Hamarsheh
size command:
• Function size gives the row and column dimensions of an image:
>> size(f);
ans =
1024 1024
>> [M , N] = size(f);
• This syntax returns the number of rows (M) and the number of columns (N) in the image.
• The following table summarizes some ways to get information about an image. These are
not specific to the Image Processing Toolbox.
Command Description
whos To get information about size, type, and bytes, of all variables.
whos I For information about an image stored in I.
size(I) To get the size of the image stored in I.
class(I) To get type of data stored in I
Displaying Images
• To display an image, the imshow
imshow function is used, which has the basic syntax:
a) imshow
imshow (f,G)
f- an image, G- the number of intensity levels used to display the image, if G is omitted, it
defaults to 256 levels.
b) imshow
imshow (f, [low high])
Displays as black all values less than or equal to low.
Displays as white all values greater than or equal to high.
The values in between are displayed using the default number of levels.
c) imshow
imshow (f ,[ ])
3
Dr. Qadri Hamarsheh
Sets variable low to the minimum value of array f and high to its maximum value.
This form is useful for images with low dynamic range.
pixval command :
• Pixval is used to display the intensity values of individual pixel interactively: Moving
the cursor, the coordinates of the cursor position and the corresponding intensity values
are shown.
• Pixval displays Red, Green, blue components, when the image is color.
• If the left button on the mouse is clicked and then held pressed, pixval displays the
Euclidean distance between the initial and current cursor location, the syntax is:
pixval
Example 1
>> f = imread ('rose_512.tif'); % read from disk an image
>> whos f % extract basic information about the image
>> imshow (f) % display the image.
• If another image, g, is displayed using imshow, Matlab replaces the image in the screen
with the new image.
>> figure, imshow (g) % keep the first image and
%output a second image.
>> imshow (f), imshow (g) % display both images
Example 2
• Suppose that we read an image h and find that using imshow (h) produces the image
that has a low dynamic range, to correct:
>> Imshow (h, [ ]) % improve the image h.
• There are a series of photos that come as part of the image processing toolkit. To get the
list of images and credits, you can type:
>> help imdemos
• If you want to view any of these photos, you can use the imshow, which opens a
separate window displaying the image. For instance:
>> imshow('football.jpg');
>> imshow('coins.png');
>> imshow('autumn.tif');
>> imshow('board.tif');