Monday, December 11, 2017

Deteksi Keretakan Tulang Berbasis Morfologi Citra


Antarmuka GUI MATLAB ini dapat dipakai untuk laboratorium sinyal bagi mahasiswa dan untuk menunjang penelitian bagi para peneliti. Anda bisa memesannya pada form pemesanan di bawah ini.












KODE UNTUK SALAH SATU EVENT CALLBACK:

% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

set(handles.pushbutton2,'Enable','off');
set(handles.pushbutton4,'Enable','off');
set(handles.pushbutton5,'Enable','off');
set(handles.pushbutton8,'Enable','off');
set(handles.pushbutton9,'Enable','on');

dimensi = str2num(get(handles.edit28,'string'));
panjang = str2num(get(handles.edit27,'string'));
derajat = str2num(get(handles.edit26,'string'));
radius1 = str2num(get(handles.edit25,'string'));
radius2 = str2num(get(handles.edit24,'string'));
tinggi = str2num(get(handles.edit23,'string'));
ukuran = str2num(get(handles.edit22,'string'));
jarak = str2num(get(handles.edit21,'string'));

switch get(get(handles.uipanel12,'SelectedObject'),'Tag')
   case 'radiobutton30',  se=strel('square',dimensi);
   case 'radiobutton29',  se=strel('line',panjang,derajat);
   case 'radiobutton28',  se=strel('disk',radius1);    
   case 'radiobutton25',  se=strel('ball',radius2,tinggi);
   case 'radiobutton26',  se=strel('diamond',ukuran);
   case 'radiobutton27',  se=strel('octagon',jarak);
end

I = getimage(handles.axes8);
ed = imdilate(I,se)-I;

axes(handles.axes14)
imshow(ed);title('Hasil Deteksi Tepi');

I2=getimage(handles.axes1);
[M N]=size(I2);

%menghitung MSE
%MSE_1 terhadap elemet penstruktur square
se=strel('square',dimensi);
ed = imdilate(I,se)-I;
H = fspecial('average');
I2 = imfilter(I2,H,'replicate');
ed2=edge(I2,'canny');
error=double(ed2) - double(ed)
MSE_1=sum(sum(error.* error)) / (M*N)

%MSE_2 terhadap elemet penstruktur line
se=strel('line',panjang,derajat);
ed = imdilate(I,se)-I;
H = fspecial('average');
I2 = imfilter(I2,H,'replicate');
ed2=edge(I2,'canny');
error=double(ed2) - double(ed);
MSE_2=sum(sum(error.*error))/(M*N)

%MSE_3 terhadap elemet penstruktur disk
se=strel('disk',radius1);
ed = imdilate(I,se)-I;
H = fspecial('average');
I2 = imfilter(I2,H,'replicate');
ed2=edge(I2,'canny');
error=double(ed2) - double(ed);
MSE_3=sum(sum(error.*error))/(M*N)

%MSE_4 terhadap elemet penstruktur ball
se=strel('ball',radius2,tinggi);
ed = imdilate(I,se)-I;
H = fspecial('average');
I2 = imfilter(I2,H,'replicate');
ed2=edge(I2,'canny');
figure
imshow(ed2)
error=double(ed) - double(ed2);
MSE_4=sum(sum(error.*error))/(M*N)


%MSE_5 terhadap elemet penstruktur diamon
se=strel('diamond',ukuran);
ed = imdilate(I,se)-I;
H = fspecial('average');
I2 = imfilter(I2,H,'replicate');
ed2=edge(I2,'canny');
error=double(ed2) - double(ed);
MSE_5=sum(sum(error.*error))/(M*N)

%MSE_6 terhadap elemet penstruktur octagon
se=strel('octagon',jarak);
ed = imdilate(I,se)-I;
H = fspecial('average');
I2 = imfilter(I2,H,'replicate');
ed2=edge(I2,'canny');
error=double(ed) - double(ed2);
MSE_6=sum(sum(error.*error))/(M*N)

MSE=[MSE_1 MSE_2 MSE_3 MSE_4 MSE_5 MSE_6];
save mse.mat MSE;


No comments: