Escolar Documentos
Profissional Documentos
Cultura Documentos
-5(a)
AIM: - Creating a GUI and performing Basic Image transformations through Buttons and Axes.
GUIs (also known as graphical user interfaces or UIs) provide point-and-click control of software
applications, eliminating the need to learn a language or type commands in order to run the
application.
MATLAB apps are self-contained MATLAB programs with GUI front ends that automate a task or
calculation. The GUI typically contains controls such as menus, toolbars, buttons, and sliders. Many
MATLAB products, such as Curve Fitting Toolbox™, Signal Processing Toolbox™, and Control
System Toolbox™ include apps with custom user interfaces. You can also create your own custom
apps, including their corresponding UIs, for others to use.
Choose the first option Blank GUI (Default) and you will see the following screen
Click on the "ok" button in the left hand side of the window. This will allow you to
drag and drop a pushbutton. Similarly, do for axes and panels.
Double click on the components you just created. A property manager will pop up and
then change the properties according to your requirements, like, colour, text style, test
size etc. Following will be the design:-
Figure 1
Basic Image Transformations, as discussed in the previous experiments, are done in
the corresponding buttons. Right Click on the button and go to ‘View Callback ’ to go
to the function code of corresponding push button.
PUSH BUTTON 1= GRAY IMAGE:
global imgbw As the image imgbw will be required in the entire
program, it is made global in this function as well as
in the functions in which it’ll be used.
[filename,path]=uigetfile(... Image and its path is stored in filename and path.
uigetfile opens a prompt box to select an image. Three
dots at end represent continue.
{'*.jpg','Jpg file(*.jpg)';... Jpg type file can be selected.
for i=1:m Two for loops to access every row and column.
for j=1:n Calculating the identity matrix of original image by
id(i,j)=imgbw(i,j); cpying every pixel of imgbw image into id matrix.
end
end
imglog(i,j)=log10(1+img1(i,j));
end
end
axes(handles.axes4); Displaying Log image in the axes 4.
imshow(imglog);
pl(i,j)=power(imgbw(i,j),2);
end
end
axes(handles.axes5); Displaying Power Law image in the axes 5.
imshow(pl);
After performing every operation in the callbacks of every push button, the final output is
given in the below figure:
Figure 2