0% found this document useful (0 votes)
247 views

Deteksi Plat Mobil Dengan Matlab

This document describes an application for detecting vehicle license plate numbers from images using MATLAB. It contains details about how the application works, including preprocessing steps like converting the image to grayscale, applying edge detection and morphological operations. It also includes the MATLAB code used for these image processing tasks and detecting the license plate region. When the "Process" button is clicked, it performs license plate detection on a sample vehicle image and displays the results. The "Save" button allows saving the detected license plate image.

Uploaded by

Dananjaya A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
247 views

Deteksi Plat Mobil Dengan Matlab

This document describes an application for detecting vehicle license plate numbers from images using MATLAB. It contains details about how the application works, including preprocessing steps like converting the image to grayscale, applying edge detection and morphological operations. It also includes the MATLAB code used for these image processing tasks and detecting the license plate region. When the "Process" button is clicked, it performs license plate detection on a sample vehicle image and displays the results. The "Save" button allows saving the detected license plate image.

Uploaded by

Dananjaya A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

PENGOLAHAN CITRA DIGITAL

APLIKASI DETEKSI NOMOR PLAT MOBIL


KELOMPOK :
DANANJAYA A. NIM : 4115211013
FERI BUDI S. NIM : 4115211019

1. APLIKASI SAAT DI JALANKAN


Aplikasi dijalankan saat ditekan tombol PROSES

TUGAS 1 PENGOLAHAN CITRA, DETEKSI PLAT MOBIL 1


Perintah menyimpan gambar hasil deteksi plat dengan menekan tombol SAVE

2. KODE PROGRAM MATLAB

function varargout = tugas_pcd(varargin)


% TUGAS_PCD MATLAB code for tugas_pcd.fig
% TUGAS_PCD, by itself, creates a new TUGAS_PCD or raises the existing
% singleton*.
%
% H = TUGAS_PCD returns the handle to a new TUGAS_PCD or the handle to
% the existing singleton*.
%
% TUGAS_PCD('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TUGAS_PCD.M with the given input
arguments.
%
% TUGAS_PCD('Property','Value',...) creates a new TUGAS_PCD or raises
the
% existing singleton*. Starting from the left, property value pairs
are
% applied to the GUI before tugas_pcd_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property
application
% stop. All inputs are passed to tugas_pcd_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 tugas_pcd

% Last Modified by GUIDE v2.5 05-Dec-2014 15:59:48

TUGAS 1 PENGOLAHAN CITRA, DETEKSI PLAT MOBIL 2


% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @tugas_pcd_OpeningFcn, ...
'gui_OutputFcn', @tugas_pcd_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 tugas_pcd is made visible.


function tugas_pcd_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 tugas_pcd (see VARARGIN)

% Choose default command line output for tugas_pcd


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

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


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = tugas_pcd_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
% 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

% --- Executes on button press in process.


function process_Callback(hObject, eventdata, handles)
% hObject handle to process (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
citra=imread('HEMM.png'); %kode ambil citra (citra car3.jpg harus sudah
ditaruh di direktori dokumen folder Matlab)
citra1=rgb2gray(citra); %kode mengkonversikan citra (car3.jpg) dari citra
berwarna menjadi grayscale (abu-abu)
TUGAS 1 PENGOLAHAN CITRA, DETEKSI PLAT MOBIL 3
citra1=medfilt2(citra1,[3 3]); %Median filter sebagai penghilang
noise(gangguan) pada citra
BW = edge(citra1,'sobel'); %menemukan deteksi tepi menggunakan metode sobel
[citrax,citray]=size(BW);%mengubah citra dalam bentuk biner/ black white
(BW)
mask=[0 0 0 0 0;
0 1 1 1 0;
0 1 1 1 0;
0 1 1 1 0;
0 0 0 0 0;];
B=conv2(double(BW),double(mask)); %kode memperhalus citra menggunakan Mask
(konvolusi dengan matrik di atas)
L = bwlabel(B,8);% menghitung komponen citra yang saling terhubung ( 8=
arah mata angin)
mx=max(max(L))%kode mendapatkan nilai maksimal pada pada komponen yang
terhubung pada citra
%[r,c] = find(L==17 | L==18 | L==19 | L==22 | L==27 | L==28);%%mencari
nomor plat yang akan diekstrak r: row, c: coloum
[r,c] = find(L==15 | L==17 | L==18 | L==20 | L==22 | L==23 | L==24 );

rc = [r c];
[sx sy]=size(rc); kanvas=zeros(citrax,citray); for i=1:sx
x1=rc(i,1); y1=rc(i,2); kanvas(x1,y1)=255;
end % mengekstrak citra
subplot(2,2,1), imshow(citra), subplot(2,2,2), imshow(citra1);%menanmpilkan
citra berwarna & citra grayscale
subplot(2,2,3), imshow(B), subplot(2,2,4), imshow(kanvas,[]);% menampilkan
citra Biner & hasil citra yang diekstrak ( nomor plat sudah terpisah dengan
background)

% --- Executes on button press in save.


function save_Callback(hObject, eventdata, handles)
% hObject handle to save (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
button = questdlg('Simpan Gambar?',...
'Simpan','Ya','Tidak','Ya');
if strcmp(button,'Tidak')
return;
end
[nama_file2, nama_path2]=uiputfile( ...
{'*.bmp','File bmp (*.bmp)';...
'*.*','Semua File (*.*)'},...
'Simpan File Citra');

if isequal([nama_file2,nama_path2],[0,0])
return;
else

imwrite(handles.citra,fullfile(nama_path2,nama_file2));
%citra=imread(fullfile(nama_path1,nama_file1));
guidata(hObject,handles);
axes(handles.axes4);
%imshow(citra);
end;

TUGAS 1 PENGOLAHAN CITRA, DETEKSI PLAT MOBIL 4

You might also like