11
Nov
08

Deteksi Tepi Dengan MATLAB

<!– @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } –>

MAT LAB lagi nih !!!!! sekarang gw mau coba ngasih tau pendekteksian tepi dengan menggunakan mat lab agak sedikit susah tapi sebenernya gw cuman ngedit dari kode yang kemaren, tampilannya (gui) juga ampir sama ama yang perataan histogram.Metode yang gw pake sobel dan prewitt

Nih source codenya :

function varargout = deteksi_tepi(varargin)

% DETEKSI_TEPI M-file for deteksi_tepi.fig

% DETEKSI_TEPI, by itself, creates a new DETEKSI_TEPI or raises the existing

% singleton*.

%

% H = DETEKSI_TEPI returns the handle to a new DETEKSI_TEPI or the handle to

% the existing singleton*.

%

% DETEKSI_TEPI(‘CALLBACK’,hObject,eventData,handles,…) calls the local

% function named CALLBACK in DETEKSI_TEPI.M with the given input arguments.

%

% DETEKSI_TEPI(‘Property’,'Value’,…) creates a new DETEKSI_TEPI or raises the

% existing singleton*. Starting from the left, property value pairs are

% applied to the GUI before deteksi_tepi_OpeningFunction gets called. An

% unrecognized property name or invalid value makes property application

% stop. All inputs are passed to deteksi_tepi_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 deteksi_tepi

% 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’, @deteksi_tepi_OpeningFcn, …

‘gui_OutputFcn’, @deteksi_tepi_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 deteksi_tepi is made visible.

function deteksi_tepi_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 deteksi_tepi (see VARARGIN)

% Choose default command line output for deteksi_tepi

handles.output = hObject;

% Update handles structure

guidata(hObject, handles);

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

% uiwait(handles.figure1);

% — Outputs from this function are returned to the command line.

function varargout = deteksi_tepi_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)

I = handles.buka ;

guidata(hObject,handles);

handles.bw=edge(I,’sobel’);

hold on;

axes(handles.axes8);

imshow(handles.bw);

handles.bw1=edge(I,’prewitt’);

hold on;

axes(handles.axes3);

imshow(handles.bw1);

handles.bw2=edge(I,’prewitt’);

hold on;

axes(handles.axes4);

imshow(handles.bw2);

Tenang aja dari semua kode itu cman ini yang penting :

handles.bw=edge(I,’sobel’); menggunakan sobel sebagai teknik pendekteksian tepi

handles.bw1=edge(I,’prewitt’);


0 Tanggapan ke “Deteksi Tepi Dengan MATLAB”



  1. Tinggalkan sebuah Komentar

Tinggalkan Balasan

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Ubah )

Twitter picture

You are commenting using your Twitter account. Log Out / Ubah )

Facebook photo

You are commenting using your Facebook account. Log Out / Ubah )

Connecting to %s


Halaman

 

November 2008
S S R K J S M
     
 12
3456789
10111213141516
17181920212223
24252627282930

Ikuti

Get every new post delivered to your Inbox.