• Tidak ada hasil yang ditemukan

BAB V PENUTUP

5.2 Saran

Saran yang dapat diberikan untuk pengembangan lebih lanjut terhadap Tugas Akhir ini :

1. Pengembangan metode kompresi seperti data streaming antara dua matlab atau lebih, serta membuat sebuah sistem streaming data yang berfungsi untuk mengirimkan data secara optimal tanpa menggangu kualitas citra.

2. Menggunakan metode RLE dan Huffman coding sebagai metode pengkompresian data multimedia seperti Video, Suara, dan data multimedia lainnya.

3. Mengkombinasikan kompresi Huffman Coding dengan RLE sehingga memperkecil kemungkinan cacatnya kualitas citra dan memperkecil ukuran citra seminimal mungkin tanpa menganggu kualitas citra.

DAFTAR PUSTAKA

[1] Sugiarto,Aris. 2006. “Pemrograman GUI dengan MATLAB”. Yogyakarta : ANDI

[2] Munir,Rinaldi.2004.”Pengolahan Citra Digital”. Bandung : Informatika Bandung.

[3] Putra,Darma.2010.”Pengolahan Citra Digital”. Yogyakarta : ANDI.

[4] Yuliana,Melita &Jalaluddin. 2012. “Implementasi Metode Run Length Encoding untuk Kompresi Citra”. Jurnal Teknika. Sekolah Tinggi Teknik Surabaya.

[5] Septriani,Anindita & Kusdianti. 2014. “ Kompresi Pada Citra Digital Menggunakan Algoritma Run Length Encoding”. Universitas Mulawarman.

[6] Munawaroh,Nur & Indah. 2008. “Implementasi Metode Huffman Untuk Kompresi File Citra bitmap 8 bit menggunakan Borland Delphi”. Jurnal Ilmiah Teknologi dan Informasi.

[7] Armanto,Hendrawan & Dewi. 2015. “Analisa Berbagai Jenis Huruf Komputer Mengguakan Algoritma Berbasis Chain Code dengan bentuk Run Length Encoding”. Sekolah Tinggi Teknik Surabaaya.

[8] Budiono,Firmana & Faradisa. 2011. “Implementasi Metode Huffman Sebagai Teknik Kompresi Citra”. Jurnal Elektro. Insitut Teknologi Malang.

[9] Alam,Ibnu. 2015. “Aplikasi Kode Huffman dalam Kompresi Gambar Berformat JPEG”. Institut Teknologi Bandung.

[10] Melita,Yuliana & Juma’in. 2011. “Kompresi Gambar atau Citra Menggunakan Discretecosine Transform”. Jurnal Teknika. Universitas lamongan.

[11] Yahya,Kurnia. 2011. “Aplikasi Kompresi citra Digital Menggunakan Teknik Kompresi Jpeg dengan Fungsi GUI pada Matlab’. Jurnal Teknika. Universitas Lamongan.

LAMPIRAN A SCRIPT PROGRAM

function varargout = lagi1(varargin)

% LAGI1 MATLAB code for lagi1.fig

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

% LAGI1('CALLBACK',hObject,eventData,handles,...) calls the local

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

%

% LAGI1('Property','Value',...) creates a new LAGI1 or raises the

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

% applied to the GUI before lagi1_OpeningFcn gets called. An

% unrecognized property name or invalid value makes property application

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

% Last Modified by GUIDE v2.5 04-Oct-2017 14:22:56

% Begin initialization code - DO NOT EDIT gui_Singleton = 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 lagi1 is made visible.

function lagi1_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)

% Choose default command line output for lagi1 handles.output = hObject;

% Update handles structure guidata(hObject, handles);

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

% uiwait(handles.figure1);

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

function varargout = lagi1_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 input1.

function input1_Callback(hObject, eventdata, handles) [nama_file,nama_path] = uigetfile(...

{'*.bmp;*.jpg','File Citra(*.bmp,*.jpg)';

'*.bmp','File Bitmap(*.bmp)';...

'*.jpg','File Citra(*.jpeg)';

'*.*','Semua File (*.*)'},...

'buka file citra asli');

if ~isequal(nama_file,0);

handles.citra=imread(fullfile(nama_path,nama_file));

red=handles.citra(:,:,1); %memisahkan warna merah dari image r=red.';

green = handles.citra(:,:,2); % memisahkan warna hijau dari image g=green.';

blue = handles.citra(:,:,3); % memisahkan warna biru dari image b=blue.';

gbr = cat (3,r,g,b);

isequal(handles.citra,gbr) gbr=double(gbr);

handles.hasilgbr=gbr;

guidata(hObject,handles);

[handles.baris handles.kolom handles.layer]=size(gbr);

handles.jum=handles.baris*handles.kolom*handles.layer;

handles.data=(reshape(gbr,1,handles.jum));

handles.pjgasli=(length(handles.data))*8;

info=imfinfo(fullfile(nama_path,nama_file));

formatny=info.Format;

guidata(hObject,handles);

axes(handles.axes1);

imshow(handles.citra);

tester1=imshow(handles.citra);

att=imagemodel(tester1);

height = getImageHeight(att) width = getImageWidth(att) title(formatny);

else

return;

end

% hObject handle to input1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in input2.

function input2_Callback(hObject, eventdata, handles)

[nama_file,nama_path] = uigetfile({'*.png','File PNG(*.png)';...

'*.tif','File TIF(*.tif)';...

'*.*','Semua File(*.*)'},...

'buka file citra asli');

if ~isequal(nama_file,0);

handles.citra1=imread(fullfile(nama_path,nama_file));

red=handles.citra1(:,:,1); %memisahkan warna merah dari image r=red.';

green = handles.citra1(:,:,2); % memisahkan warna hijau dari image g=green.';

blue = handles.citra1(:,:,3); % memisahkan warna biru dari image b=blue.';

gbr1 = cat (3,r,g,b);

isequal(handles.citra1,gbr1) gbr1=double(gbr1);

handles.hasilgbr2=gbr1;

guidata(hObject,handles);

[handles.baris2 handles.kolom2 handles.layer2]=size(gbr1);

handles.jum1=handles.baris2*handles.kolom2*handles.layer2;

handles.data1=(reshape(gbr1,1,handles.jum1));

handles.pjgasli1=(length(handles.data1))*8;

info1=imfinfo(fullfile(nama_path,nama_file));

formatnya=info1.Format;

guidata(hObject,handles);

axes(handles.axes2);

imshow(handles.citra1);

tester2=imshow(handles.citra1);

att1=imagemodel(tester2);

height1 = getImageHeight(att1) width1 = getImageWidth(att1) title(formatnya);

set(handles.width2,'String',width1);

set(handles.height2,'String',height1);

set(handles.ukuran1,'String',handles.pjgasli1);

else

return;

end

% hObject handle to input2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in rle.

function rle_Callback(hObject, eventdata, handles)

tic

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in huffman.

function huffman_Callback(hObject, eventdata, handles)

handles.dict = huffmandict(nil,frek); % Create the dictionary.

hcode = huffmanenco(handles.data,handles.dict);

handles.hcode1=hcode;

guidata(hObject,handles);

pjghuff=length(hcode);

ratio2=100-((pjghuff/handles.pjgasli)*100);

set(handles.huff_size,'String',pjghuff);

% hObject handle to huffman (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in rlee.

function rlee_Callback(hObject, eventdata, handles)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in huffman1.

function huffman1_Callback(hObject, eventdata, handles)

handles.diction = huffmandict(nil,frek); % Create the dictionary.

% hObject handle to huffman1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in dedm.

function dedm_Callback(hObject, eventdata, handles)

% hObject handle to dedm (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in dehuffman.

function dehuffman_Callback(hObject, eventdata, handles) tic

h = waitbar(0,'Please Wait...');

for i=1:50,

dhsig = huffmandeco(hcode,handles.dict); % Decode the code.

hsl=uint8(reshape(dhsig,handles.baris,handles.kolom,handles.layer));

red = hsl(:,:,1); % memisahkan warna merah dari image r=red.';

green = hsl(:,:,2); % memisahkan warna hijau dari image g=green.';

blue = hsl(:,:,3); % memisahkan warna biru dari image b=blue.';

ratio3=100-((handles.pjgdecohuff/handles.pjgasli)*100);

% hObject handle to dehuffman (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in dedm1.

function dedm1_Callback(hObject, eventdata, handles)

% hObject handle to dedm1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in dehuffman1.

function dehuffman1_Callback(hObject, eventdata, handles) tic

h = waitbar(0,'Please Wait...');

for i=1:50,

dhsig1 = huffmandeco(hcode1,handles.diction); % Decode the code.

hs5=uint8(reshape(dhsig1,handles.baris2,handles.kolom2,handles.layer2));

red = hs5(:,:,1); % memisahkan warna merah dari image r=red.';

green = hs5(:,:,2); % memisahkan warna hijau dari image g=green.';

blue = hs5(:,:,3); % memisahkan warna biru dari image b=blue.';

hslhuff1 = cat (3,r,g,b);

isequal(hs5,hslhuff1)

set(handles.dehuff_size1,'String',handles.pjgdecohuff1);

set(handles.widthH3,'String',widthh3);

set(handles.heightH3,'String',heighth3);

% hObject handle to dehuffman1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in drle.

function drle_Callback(hObject, eventdata, handles)

% hObject handle to drle (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in derlee.

function derlee_Callback(hObject, eventdata, handles)

red = hsl2(:,:,1); % memisahkan warna merah dari image r=red.';

green = hsl2(:,:,2); % memisahkan warna hijau dari image

hslrle1 = cat (3,r,g,b);

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton13.

function pushbutton13_Callback(hObject, eventdata, handles) awal=imresize(handles.hasilgbr,[258 258]);

akhir=handles.hasilhuff;

bicube_ima = imresize(akhir,[572 572]);

last_ima=imrotate(bicube_ima,270);

handles.bicube_ima = bicube_ima;

bi_cu = imresize(bicube_ima,[258 258]);

n=size(awal);

M=n(1);

N=n(2);

MSEhuff = sum(sum((awal - bi_cu).^2))/(M*N);

PSNRhuff = 10*log10(258*258/MSEhuff);

guidata(hObject, handles);

set(handles.text150,'string',MSEhuff);

set(handles.text151,'string',PSNRhuff);

% hObject handle to pushbutton13 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton14.

function pushbutton14_Callback(hObject, eventdata, handles) awal1=imresize(handles.hasilgbr,[256 256]);

bicube_ima1 = imresize(akhir1,[512 512]);

last_ima1=imrotate(bicube_ima1,270);

handles.bicube_ima1 = bicube_ima1;

bi_cu1 = imresize(bicube_ima1,[256 256]);

n=size(awal1);

M=n(1);

N=n(2);

MSErle = sum(sum((awal1 - bi_cu1).^2))/(M*N);

PSNRrle = 10*log10(256*256/MSErle);

guidata(hObject, handles);

set(handles.text156,'string',MSErle);

set(handles.text157,'string',PSNRrle);

% hObject handle to pushbutton14 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton15.

function pushbutton15_Callback(hObject, eventdata, handles) awal3=imresize(handles.hasilgbr2,[258 258]);

akhir3=handles.hasilhuff1;

bicube_ima3 = imresize(akhir3,[512 512]);

handles.bicube_ima3 = bicube_ima3;

bi_cu2 = imresize(bicube_ima3,[258 258]);

n=size(awal3);

M=n(1);

N=n(2);

MSEhuff1 = sum(sum((awal3 - bi_cu2).^2))/(M*N);

PSNRhuff1 = 10*log10(256*256/MSEhuff1);

guidata(hObject, handles);

set(handles.text162,'string',MSEhuff1);

set(handles.text163,'string',PSNRhuff1);

% hObject handle to pushbutton15 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton16.

function pushbutton16_Callback(hObject, eventdata, handles) awal2=imresize(handles.hasilgbr2,[256 256]);

akhir2=handles.hasilrle1;

bicube_ima2 = imresize(akhir2,[515 515]);

last_ima2=imrotate(bicube_ima2,270);

handles.bicube_ima2 = bicube_ima2;

M=n(1);

N=n(2);

MSErle1 = sum(sum((awal2 - bi_cu2).^2))/(M*N);

PSNRrle1 = 10*log10(256*256/MSErle1);

guidata(hObject, handles);

set(handles.text168,'string',MSErle1);

set(handles.text169,'string',PSNRrle1);

% hObject handle to pushbutton16 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in derle.

function derle_Callback(hObject, eventdata, handles)

red = hsl(:,:,1); % memisahkan warna merah dari image r=red.';

green = hsl(:,:,2); % memisahkan warna hijau dari image g=green.';

blue = hsl(:,:,3); % memisahkan warna biru dari image b=blue.';

hslrle = cat (3,r,g,b);

hasilrle = double(hsl);

handles.hasilrle=hasilrle;

[handles.baris1 handles.kolom1 handles.layer1]=size(hsl);

handles.jum2=handles.baris1*handles.kolom1*handles.layer1;

handles.data2=(reshape(hsl,1,handles.jum2));

handles.pjgdecorle=(length(handles.data2))*8;

axes(handles.axes7);

imshow(hslrle);

tester3=imshow(hslrle);

att3=imagemodel(tester3);

height2 = getImageHeight(att3) width2 = getImageWidth(att3) guidata(hObject,handles);

ratiorle=100-((handles.pjgdecorle/handles.pjgasli)*100);

trle=toc;

set(handles.drle_rat,'String',ratiorle);

set(handles.drle_pro,'String',trle );

set(handles.drle_size,'String',handles.pjgdecorle);

set(handles.width3,'String',width2);

set(handles.height3,'String',height2);

% hObject handle to derle (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

LAMPIRAN B

HASIL PENGUJIAN SISTEM

1.

2.

3.

4.

5.

6.

7.

8.

9.

10.

11.

12.

13.

14.

Dokumen terkait