1.(a)
Interactively load the image grey1.jpg from this directory into a matlab array.
(b) Display it as a mirror image
( c) Display it as a negative image
(d) Display it as a black and white image,
i.e., no shades of grey
2. MATLAB does not
have a function to determine which elements of an array are even numbers (i.e., . . . -4, -2, 0, 2, 4 , . . .). Write a function for this
purpose, with the following specifications:
function E = iseven(A)
%ISEVEN Determines which elements of an array are even
numbers.
% E = ISEVEN(A) returns a logical array, E, of
the same size as A,
% with 1s (TRUE) in the locations corresponding to even numbers
% (i.e., . . . -3, -1, 0, 2, 4, . . . )in A,
and 0s (FALSE) elsewhere.
% A must be a numeric array.
Use of while or for loops is not allowed. Hint: Become familiar with function floor.
3. Write an
M-function with the following specifications:
function H = scircle(R, S)
%SCIRCLE Generates a circle inside a square.
% H = SCIRCLE(R, S) generates a circle of radius R centered
% on a square
of edge S. H is a binary image with
% 1s in the circle and 0s elsewhere. R,S must be
integers >= 1.
Your program must
check the validity of R and also it should check to
make sure that the specified circle fits in the given square. Use of for or while loops is not permitted. Hint: Review function
meshgrid and
become familiar with function floor.