Professional Documents
Culture Documents
Bab I Permasalahan
Bab I Permasalahan
Permasalahan
1. Membuat Push-Button Buka Citra bisa open file image dengan type file .jpg,
.bmp, .tif, .gif.
2. Membuat pop-upmenu Histogram hilang saat gambar abu-abu dan muncul
kembalu pada saat gambar berwarna/RGB.
3. Memberikan komentar pada program yang dibuat beserta screen shot.
BAB II
Pembahasan
1. Source Code
function varargout = devi(varargin)
% BARU MATLAB code for baru.fig
%
BARU, by itself, creates a new BARU or raises the existing
%
singleton*.
%
%
H = BARU returns the handle to a new BARU or the handle to
%
the existing singleton*.
%
%
BARU('CALLBACK',hObject,eventData,handles,...) calls the local
%
function named CALLBACK in BARU.M with the given input arguments.
%
%
BARU('Property','Value',...) creates a new BARU or raises the
%
existing singleton*. Starting from the left, property value pairs
are
%
applied to the GUI before baru_OpeningFcn gets called. An
%
unrecognized property name or invalid value makes property
application
%
stop. All inputs are passed to baru_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 baru
% Last Modified by GUIDE v2.5 25-Oct-2016 05:29:10
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',
mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @baru_OpeningFcn, ...
'gui_OutputFcn', @baru_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
% eventdata
% handles
% varargin
% --- Outputs from this function are returned to the command line.
function varargout = baru_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;
%
str2double(get(hObject,'String')) returns contents of editSize as
a double
set(handles.editName,'string',info.Filename);
dari info image itu sendiri
set(handles.editType,'string',info.Format);
info image itu sendiri
set(handles.editSize,'string',info.FileSize);
info image itu sendiri
handles.y=y;
[f]=histogram(handles.y);
dari image yang dipilih
%f = perhitingan histogram
absis=0:1:255;
axes(handles.axes2)
histogram image yang dipilih
plot(absis,f,'k')
hasil perhitungan histogram image
%fungsi untuk menampakkan pop-up Histogram citra jika gambar berwarna (RGB)
%dan tidak jika gambar grayscale
if size(handles.y,3)==1;
set(handles.popupmenu2,'Visible','off');
%menyembunyikan popup Histogram
drawnow;
else
set(handles.popupmenu2,'Visible','on');
%menampilkan kembali popup
Histogram
drawnow;
end
grid on
%menampilkan grid pada kotak
histogram
guidata(hObject, handles);
axes(handles.axes2)
Hstogram
plot(absis,f3,'b')
%untuk menggambar grafik
hasil perhitungan histogram image
grid on
%menampilkan grid pada
kotak histogram
end
end
end
end
% hObject
handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles
structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2
contents as cell array
%
contents{get(hObject,'Value')} returns selected item from
popupmenu2
2. Screen Shot
a. Gambar 1
c. Gambar 3
e. Gambar 5
f. Gambar 6
g. Gambar 7