Masih tentang pengolahan citra tugas kedua makin berat nih MATLAB!!!! liat aja belum pernah, udah disuruh bikin perataan histogram aduu…uh ribet dech jadi puyeng. Pertama- tama gw memulai mencari mentahan MATLAB, kebetulan gw dapet yang versi 7 dari temen (bajakan……sst!). Lalu diinstal klik next aja terus. ***10 menit kemudian***. ampe ketemu finish Udah beres kan lanjutkan dengan melihat- lihat help yang sudah disediakan (lagi-lagi bahasa inggris). Udah puyeng ga ngerti lalu gw ngebrowse cari tutorial indonesia buat matlab + bahan buat perataan histogram.
Nich sourcode perataan histogram khusus grayscale yang udah gw edit dan gw telaah 3 hari 3 malam lalu telah amat disederhanakan guna kemudahan saat ditanya dosen, gw menggunakan gui biar mantab :
LISTING Coba.m
function varargout = coba(varargin)
% COBA M-file for coba.fig
% COBA, by itself, creates a new COBA or raises the existing
% singleton*.
%
% H = COBA returns the handle to a new COBA or the handle to
% the existing singleton*.
%
% COBA(‘CALLBACK’,hObject,eventData,handles,…) calls the local
% function named CALLBACK in COBA.M with the given input arguments.
%
% COBA(‘Property’,'Value’,…) creates a new COBA or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before coba_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to coba_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 coba
% Last Modified by GUIDE v2.5 12-Oct-2008 20:05:38
% Begin initialization code – DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …
‘gui_Singleton’, gui_Singleton, …
‘gui_OpeningFcn’, @coba_OpeningFcn, …
‘gui_OutputFcn’, @coba_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 coba is made visible.
function coba_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 coba (see VARARGIN)
% Choose default command line output for coba
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes coba wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% — Outputs from this function are returned to the command line.
function varargout = coba_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 during object creation, after setting all properties.
function text1_CreateFcn(hObject, eventdata, handles)
% hObject handle to text1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% — Executes on button press in cari.
function cari_Callback(hObject, eventdata, handles)
% hObject handle to cari (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[a, path]=uigetfile(…
{‘*.bmp;*.jpg’,'File yg dpet dibuka (*.bmp,*.jpg)’;
},…
‘Browser’);
if ~isequal(a, 0)
handles.buka=imread(fullfile(path,a));
guidata(hObject,handles);
hold on;
axes(handles.axes1);
imshow(handles.buka);
hold on;
axes(handles.axes2);
imhist(handles.buka);
else
return;
end
set(handles.text1,’string’,a);
% — Executes on button press in proses.
function proses_Callback(hObject, eventdata, handles)
% hObject handle to proses (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.proses=histeq(handles.buka);
guidata(hObject,handles);
hold on;
axes(handles.axes3);
imshow(handles.proses);
hold on;
axes(handles.axes4);
imhist(handles.proses);
Ga usah pusing Inti program ini cuman di statement ini handles.proses=histeq(handles.buka); selesai mudah kan. O ya ini cuman coba.m nya doang desainnya ada di coba.fig sengaja gw ga lampirin abis gw ga tau caranya maklum pengguna blog baru.
0 Tanggapan ke “Perataan Histogram Dengan MATLAB”