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

Praktikum M

The document contains code for an image processing GUI application. It includes functions for 4 buttons - the first loads different images into the main axes, the second applies different edge detection algorithms (Roberts, Prewitt, Sobel, Canny) to images and displays the output in a second axes. Each button loads an image, applies the algorithm, saves the output and displays the image.
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)
12 views

Praktikum M

The document contains code for an image processing GUI application. It includes functions for 4 buttons - the first loads different images into the main axes, the second applies different edge detection algorithms (Roberts, Prewitt, Sobel, Canny) to images and displays the output in a second axes. Each button loads an image, applies the algorithm, saves the output and displays the image.
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/ 3

% --- Executes on button press in pushbutton1.

function pushbutton1_Callback(hObject, eventdata, handles)


% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName]=uigetfile('*.jpeg','select image file');
rumah=imread([PathName,FileName]);
handles.rumah=rumah;
guidata(hObject,handles);
axes(handles.axes1);
imshow(rumah);

% --- Executes on button press in pushbutton1.


function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName]=uigetfile('*.jpeg','select image file');
daun1=imread([PathName,FileName]);
handles.daun1=daun1;
guidata(hObject,handles);
axes(handles.axes1);
imshow(daun1);

% --- Executes on button press in pushbutton1.


function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName]=uigetfile('*.jpeg','select image file');
tengkorak=imread([PathName,FileName]);
handles.tengkorak=tengkorak;
guidata(hObject,handles);
axes(handles.axes1);
imshow(tengkorak);
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName]=uigetfile('*.jpeg','select image file');
planet=imread([PathName,FileName]);
handles.planet=planet;
guidata(hObject,handles);
axes(handles.axes1);
imshow(planet);

% --- Executes on button press in pushbutton2.


function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName]=uigetfile('*.jpeg','select image file');
rumah=imread([PathName,FileName]);
bi=im2bw(rumah,0.4);
roberts=edge(bi, ‘roberts’);
handles.roberts=roberts;
guidata(hObject,handles);
axes(handles.axes2);
imshow(roberts);

% --- Executes on button press in pushbutton2.


function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName]=uigetfile('*.jpeg','select image file');
daun=imread([PathName,FileName]);
bi=im2bw(rumah,0.4);
pre=edge(bi, ‘prewitt’);
handles.pre=pre;
guidata(hObject,handles);
axes(handles.axes2);
imshow(pre);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName]=uigetfile('*.jpeg','select image file');
tengkorak=imread([PathName,FileName]);
bi=im2bw(rumah,0.4);
sobel=edge(bi, ‘sobel’);
handles.so=so;
guidata(hObject,handles);
axes(handles.axes2);
imshow(so);

% --- Executes on button press in pushbutton2.


function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName]=uigetfile('*.jpeg','select image file');
planet=imread([PathName,FileName]);
bi=im2bw(rumah,0.4);
canny=edge(bi, ‘canny’);
handles.can=can;
guidata(hObject,handles);
axes(handles.axes2);
imshow(can);

You might also like