MATLAB: Understanding of Matlab (image processing)

functionimage processingImage Processing Toolbox

Hi. Currently i am doing a proj of image processing. i was told to create a funtion-m file with the function,arguements to display any image etc. but i do not know what are the input and output arguments i should put to display my image? I have tried studying/viewing from lots of videos to understand it but almost all explanation in arguments uses 'points'. I should plot my image first to do the function part? I am really confused, i hope any of you can give a simple explanation for me[ using codes etc ] to let me understand better. [ new to matlab ] thank you very much.

Best Answer

There is an advantage in MATLAB that when a function is created, it can be used as a command in another file. say for example,
%Type this in one file
A=imread('input.jpg'); % Reads input Image
B = imagedisplay(A); % Call the function image display
% Here A, input argument, B output argument
figure, imshow(B);
-------------------------------------------------
%Type this in other file
function [output_img] = imagedisplay(input_img)
output_img = rgb2gray(input_img);
--------------------------------------------------
This function returns an image called ' output_img' and that is displayed in the main program.