Image Processing Reference
In-Depth Information
%Chapter 1 Introduction (Hello Matlab) CHAPTER1.M
%Written by: Mark S. Nixon
disp('Welcome to the Chapter1 script')
disp('This worksheet is the companion to Chapter 1 and is an
introduction.')
disp('It is the source of Section 1.4.3 Hello Matlab.')
disp('The worksheet follows the text directly and allows you to
process basic images.')
disp('Let us define a matrix, a synthetic computer image called
pic.')
pic =[1 2 3 4 1 1 2 1;
2232 1 22 ;
3 1 38 39 37 36 3 1;
4 1 45 44 41 42 2 1;
1 2 43 44 40 39 1 3;
2 1 39 41 42 40 2 1;
1212 2 31 ;
1213 1 14 ]
%Pixels are addressed in row-column format.
%Using x for the horizontal axis(a column count), and y for the
vertical axis (a row
%count) then picture points are addressed as pic(y,x). The origin
is at co-ordinates
%(1,1), so the point pic(3,3) is on the third row and third column;
the point pic(4,3)
%is on the fourth row, at the third column. Let's print them:
disp ('The element pic(3,3)is')
pic(3,3)
disp('The element pic(4,3)is')
pic(4,3)
%We'll set the output display to black and white
colormap(gray);
%We can view the matrix as a surface plot
disp ('We shall now view it as a surface plot (play with the
controls to see it in relief)')
disp('When you are ready to move on, press RETURN')
surface(pic);
%Let's hold a while so we can view it
pause;
%Or view it as an image
disp ('We shall now view the array as an image')
disp('When you are ready to move on, press RETURN)
imagesc(pic);
%Let's hold a while so we can view it
pause;
%Let's look at the array's dimensions
Search WWH ::




Custom Search