0% found this document useful (0 votes)
56 views8 pages

Tugas Praktikum 1

This document contains the code for three MATLAB GUI applications (TugasPraktikum1Nomor1, TugasPraktikum1Nomor2, TugasPraktikum1Nomor3) that perform image processing tasks. Each application loads an image, allows it to be displayed and manipulated. TugasPraktikum1Nomor1 loads an image and displays it in two axes. TugasPraktikum1Nomor2 loads an image, calculates the grayscale average, and displays the mirror image. TugasPraktikum1Nomor3 loads an image but the processing is not described.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views8 pages

Tugas Praktikum 1

This document contains the code for three MATLAB GUI applications (TugasPraktikum1Nomor1, TugasPraktikum1Nomor2, TugasPraktikum1Nomor3) that perform image processing tasks. Each application loads an image, allows it to be displayed and manipulated. TugasPraktikum1Nomor1 loads an image and displays it in two axes. TugasPraktikum1Nomor2 loads an image, calculates the grayscale average, and displays the mirror image. TugasPraktikum1Nomor3 loads an image but the processing is not described.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Nomor 1

function varargout = TugasPraktikum1Nomor1(varargin)


% TUGASPRAKTIKUM1NOMOR1 MATLAB code for TugasPraktikum1Nomor1.fig
% TUGASPRAKTIKUM1NOMOR1, by itself, creates a new TUGASPRAKTIKUM1NOMOR1
or raises the existing
% singleton*.
%
% H = TUGASPRAKTIKUM1NOMOR1 returns the handle to a new
TUGASPRAKTIKUM1NOMOR1 or the handle to
% the existing singleton*.
%
% TUGASPRAKTIKUM1NOMOR1('CALLBACK',hObject,eventData,handles,...) calls
the local
% function named CALLBACK in TUGASPRAKTIKUM1NOMOR1.M with the given
input arguments.
%
% TUGASPRAKTIKUM1NOMOR1('Property','Value',...) creates a new
TUGASPRAKTIKUM1NOMOR1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before TugasPraktikum1Nomor1_OpeningFcn gets
called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to TugasPraktikum1Nomor1_OpeningFcn via
varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help TugasPraktikum1Nomor1

% Last Modified by GUIDE v2.5 01-Oct-2019 14:12:16

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @TugasPraktikum1Nomor1_OpeningFcn, ...
'gui_OutputFcn', @TugasPraktikum1Nomor1_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before TugasPraktikum1Nomor1 is made visible.


function TugasPraktikum1Nomor1_OpeningFcn(hObject, eventdata, handles,
varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to TugasPraktikum1Nomor1 (see VARARGIN)

% Choose default command line output for TugasPraktikum1Nomor1


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes TugasPraktikum1Nomor1 wait for user response (see UIRESUME)


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = TugasPraktikum1Nomor1_OutputFcn(hObject, eventdata,
handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure


varargout{1} = handles.output;

% --- Executes on button press in pushbutton1.


function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
open=guidata(gcbo);
[FN PN]=uigetfile({'*.jpeg';'*.bmp';'*.jpg'},'Select the Matlab Code File');
axes1.visible='on';
A=imread(FN);
handles.A=A;
guidata(hObject,handles);
axes(handles.axes1);
imshow(A);

% --- Executes on button press in pushbutton2.


function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Gambar=handles.A;
axes(handles.axes2);
imshow(Gambar);
guidata(hObject,handles);
Nomor 2
function varargout = TugasPraktikum1Nomor2(varargin)
% TUGASPRAKTIKUM1NOMOR2 MATLAB code for TugasPraktikum1Nomor2.fig
% TUGASPRAKTIKUM1NOMOR2, by itself, creates a new TUGASPRAKTIKUM1NOMOR2
or raises the existing
% singleton*.
%
% H = TUGASPRAKTIKUM1NOMOR2 returns the handle to a new
TUGASPRAKTIKUM1NOMOR2 or the handle to
% the existing singleton*.
%
% TUGASPRAKTIKUM1NOMOR2('CALLBACK',hObject,eventData,handles,...) calls
the local
% function named CALLBACK in TUGASPRAKTIKUM1NOMOR2.M with the given
input arguments.
%
% TUGASPRAKTIKUM1NOMOR2('Property','Value',...) creates a new
TUGASPRAKTIKUM1NOMOR2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before TugasPraktikum1Nomor2_OpeningFcn gets
called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to TugasPraktikum1Nomor2_OpeningFcn via
varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help TugasPraktikum1Nomor2

% Last Modified by GUIDE v2.5 01-Oct-2019 14:26:52

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @TugasPraktikum1Nomor2_OpeningFcn, ...
'gui_OutputFcn', @TugasPraktikum1Nomor2_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before TugasPraktikum1Nomor2 is made visible.


function TugasPraktikum1Nomor2_OpeningFcn(hObject, eventdata, handles,
varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to TugasPraktikum1Nomor2 (see VARARGIN)

% Choose default command line output for TugasPraktikum1Nomor2


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes TugasPraktikum1Nomor2 wait for user response (see UIRESUME)


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = TugasPraktikum1Nomor2_OutputFcn(hObject, eventdata,
handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure


varargout{1} = handles.output;

% --- Executes on button press in pushbutton1.


function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
open=guidata(gcbo);
[FN PN]=uigetfile({'*.jpeg';'*.bmp';'*.jpg'},'Select the Matlab Code File');
axes1.visible='on';
A=imread(FN);
handles.A=A;
guidata(hObject,handles);
axes(handles.axes1);
imshow(A);

% --- Executes on button press in pushbutton2.


function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
B=handles.A;
X=uint8((double(B(:,:,1))+double(B(:,:,2))+double(B(:,:,3)))/3);
[br kl]=size(X);
flip=repmat(0,br,kl);
mirror=floor(kl/2);
for x=1:br-1
for y=1:kl-1
flip(x,y)=X(x,(2*mirror)-y);
end
end
axes(handles.axes2);
imshow(uint8(flip));
guidata(hObject,handles);
Nomer 3
function varargout = TugasPraktikum1Nomor3(varargin)
% TUGASPRAKTIKUM1NOMOR3 MATLAB code for TugasPraktikum1Nomor3.fig
% TUGASPRAKTIKUM1NOMOR3, by itself, creates a new TUGASPRAKTIKUM1NOMOR3
or raises the existing
% singleton*.
%
% H = TUGASPRAKTIKUM1NOMOR3 returns the handle to a new
TUGASPRAKTIKUM1NOMOR3 or the handle to
% the existing singleton*.
%
% TUGASPRAKTIKUM1NOMOR3('CALLBACK',hObject,eventData,handles,...) calls
the local
% function named CALLBACK in TUGASPRAKTIKUM1NOMOR3.M with the given
input arguments.
%
% TUGASPRAKTIKUM1NOMOR3('Property','Value',...) creates a new
TUGASPRAKTIKUM1NOMOR3 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before TugasPraktikum1Nomor3_OpeningFcn gets
called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to TugasPraktikum1Nomor3_OpeningFcn via
varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help TugasPraktikum1Nomor3

% Last Modified by GUIDE v2.5 01-Oct-2019 14:43:22

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @TugasPraktikum1Nomor3_OpeningFcn, ...
'gui_OutputFcn', @TugasPraktikum1Nomor3_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before TugasPraktikum1Nomor3 is made visible.


function TugasPraktikum1Nomor3_OpeningFcn(hObject, eventdata, handles,
varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to TugasPraktikum1Nomor3 (see VARARGIN)

% Choose default command line output for TugasPraktikum1Nomor3


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes TugasPraktikum1Nomor3 wait for user response (see UIRESUME)


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = TugasPraktikum1Nomor3_OutputFcn(hObject, eventdata,
handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure


varargout{1} = handles.output;

% --- Executes on button press in pushbutton1.


function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
open=guidata(gcbo);
[FN PN]=uigetfile({'*.jpeg';'*.bmp';'*.jpg'},'Select the Matlab Code File');
axes1.visible='on';
A=imread(FN);
handles.A=A;
guidata(hObject,handles);
axes(handles.axes1);
imshow(A);

% --- Executes on button press in pushbutton2.


function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
B=handles.A;
GS=uint8((double(B(:,:,1))+double(B(:,:,2))+double(B(:,:,3)))/3);
d=GS';
[br, kl]=size(GS);
for i=1:br
for j=1:kl
d(kl+1-i,i)=GS(i,j);
end
end
axes(handles.axes2);
imshow(uint8(d));
guidata(hObject,handles);

You might also like