function varargout =
LATIHAN6(varargin)
% LATIHAN6 M-file for LATIHAN6.fig
% LATIHAN6, by itself, creates a new
LATIHAN6 or raises the existing
% singleton*.
% H = LATIHAN6 returns the handle to a new
LATIHAN6 or the handle to
% the existing singleton*.
%
LATIHAN6('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in LATIHAN6.M
with the given input arguments.
% LATIHAN6('Property','Value',...) creates
a new LATIHAN6 or raises the
% existing singleton*. Starting from the left, property value pairs
are
% applied to the GUI before
LATIHAN6_OpeningFunction gets called. An
% unrecognized property name or invalid
value makes property application
% stop.
All inputs are passed to LATIHAN6_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
% Copyright 2002-2003 The MathWorks,
Inc.
% Edit the above text to modify the
response to help LATIHAN6
% Last Modified by GUIDE v2.5
22-Jun-2014 20:41:31
% Begin initialization code - DO NOT
EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn',
@LATIHAN6_OpeningFcn, ...
'gui_OutputFcn', @LATIHAN6_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 LATIHAN6
is made visible.
function
LATIHAN6_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 LATIHAN6 (see
VARARGIN)
% Choose default command line output
for LATIHAN6
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes LATIHAN6 wait for
user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are
returned to the command line.
function varargout =
LATIHAN6_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)
[filename,pathname] = uigetfile( ...
{'*.bmp;*.jpg;*.tif','Files of type (*.bmp,*.jpg,*.tif)';
'*.bmp','File Bitmap (*.bmp)';
'*.jpg','File jpeg (*.jpg)';
'*.tif','File Tif (*.tif)';
'*.*','All Files (*.*)'},...
'Open Image');
%cek file name
if
isequal([filename,pathname],[0,0])
return
else
fullpath =
fullfile(pathname,filename);
handles.gui.fullpath = fullpath;
handles.gui.filename = filename;
handles.gui.pathname = pathname;
%tuliskan nama file pada bagian edit
text
set(handles.edit1,'String',handles.gui.fullpath);
guidata(hObject, handles);
end
axes(handles.axes1);
I = imread(handles.gui.fullpath);
imshow(I);
info=imfinfo(fullpath);
set(handles.edit2,'String',info.Width);
set(handles.edit3,'String',info.Height);
pilih=handles.pilih %berhubungan
dengan pilihan pada radio button
switch handles.pilih
case 1 %jika radio button grayscale dipilih
image1=imread(handles.gui.fullpath);
pilih=rgb2gray(image1);
axes(handles.axes2);
imshow(pilih);
handles.data2=pilih;
guidata(hObject,handles);
case 2
image1=imread(handles.gui.fullpath);
pilih=im2bw(image1);
axes(handles.axes2);
imshow(pilih);
handles.data2=pilih;
guidata(hObject,handles);
case 3
image1=imread(handles.gui.fullpath);
pilih=imcrop(image1,[170 120 340 367]);
axes(handles.axes2);
imshow(pilih);
handles.data2=pilih;
guidata(hObject,handles);
case 4
axes(handles.axes2);
image1=imread(handles.gui.fullpath);
pilih=rgb2gray(image1);
K=pilih;
[baris kolom]=size(K);
for i=1:baris;
for j=1:kolom;
L(j,baris+1-i)=K(i,j);
end
end
L=uint8(L);
imshow(L)
handles.data2=pilih;
guidata(hObject,handles);
end
function edit1_Callback(hObject,
eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles structure with handles and user data (see
GUIDATA)
% Hints: get(hObject,'String')
returns contents of edit1 as text
% str2double(get(hObject,'String'))
returns contents of edit1 as a double
% --- Executes during object
creation, after setting all properties.
function edit1_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles empty - handles not created until after all
CreateFcns called
% Hint: edit controls usually have a
white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes on button press in
pilih.
function pilih_Callback(hObject,
eventdata, handles)
% hObject handle to pilih (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles structure with handles and user data (see
GUIDATA)
% Hint: get(hObject,'Value') returns
toggle state of pilih
pilih = 1;
handles.pilih = pilih;
guidata(hObject,handles);
image1=imread(handles.gui.fullpath);
pilih=rgb2gray(image1);
axes(handles.axes2);
imshow(pilih);
handles.data2=pilih;
guidata(hObject,handles);
% --- Executes on button press in
radiobutton2.
function radiobutton2_Callback(hObject,
eventdata, handles)
% hObject handle to radiobutton2 (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles structure with handles and user data (see
GUIDATA)
% Hint: get(hObject,'Value') returns
toggle state of radiobutton2
pilih = 2;
handles.pilih = pilih;
guidata(hObject,handles);
image1=imread(handles.gui.fullpath);
pilih=im2bw(image1);
axes(handles.axes2);
imshow(pilih);
handles.data2=pilih;
guidata(hObject,handles);
% --- Executes on button press in
radiobutton3.
function
radiobutton3_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton3 (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles structure with handles and user data (see
GUIDATA)
% Hint: get(hObject,'Value') returns
toggle state of radiobutton3
pilih = 3;
handles.pilih = pilih;
guidata(hObject,handles);
image1=imread(handles.gui.fullpath);
pilih=imcrop(image1,[170 120 340
367]);
axes(handles.axes2);
imshow(pilih);
% --- Executes on button press in
radiobutton4.
function
radiobutton4_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton4 (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles structure with handles and user data (see
GUIDATA)
% Hint: get(hObject,'Value') returns
toggle state of radiobutton4
pilih = 4;
handles.pilih = pilih;
guidata(hObject,handles);
image1=imread(handles.gui.fullpath);
pilih=rgb2gray(image1);
K=pilih;
[baris kolom]=size(K);
for i=1:baris;
for j=1:kolom;
L(j,baris+1-i)=K(i,j);
end
end
L=uint8(L);
imshow(L)
axes(handles.axes2);
function edit2_Callback(hObject,
eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles structure with handles and user data (see
GUIDATA)
% Hints: get(hObject,'String')
returns contents of edit2 as text
% str2double(get(hObject,'String'))
returns contents of edit2 as a double
% --- Executes during object
creation, after setting all properties.
function edit2_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles empty - handles not created until after all
CreateFcns called
% Hint: edit controls usually have a
white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function edit3_Callback(hObject,
eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles structure with handles and user data (see
GUIDATA)
% Hints: get(hObject,'String')
returns contents of edit3 as text
% str2double(get(hObject,'String'))
returns contents of edit3 as a double
% --- Executes during object
creation, after setting all properties.
function edit3_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles empty - handles not created until after all
CreateFcns called
% Hint: edit controls usually have a
white background on Windows.
% See ISPC and COMPUTER.
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- 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)
selection = questdlg(['benar kah
ingin menutup ' get(handles.figure1,'Name') '?'],...
['Tutup '
get(handles.figure1,'Name') '...'],...
'KELUAR','TIDAK','KELUAR');
if strcmp(selection,'TIDAK')
return;
end
delete(handles.figure1)
selamat mencoba.....
tanya lebih lanjut bisa email
yusuffkurniawan91@gmail.com
Tidak ada komentar:
Posting Komentar