APLIKASI THRESHOLDING
TUGAS DWIKI WACHYU AJI NPM 17100104
[name_file1,name_path1] = uigetfile(...
{'*.bmp;*.jpg;*.tif','File of type (*.bmp,*.jpg,*.tif)';
'*.bmp','File Bitmap (*.bmp)';...
'*.jpg','File jpeg (*.jpg)';
'*.tif','File Tif (*.tif)';
'*.*','All File (*.*)'},...
'Open Image');
if ~isequal (name_file1,0)
handles.data1 = imread(fullfile(name_path1,name_file1));
guidata(hObject,handles);
axes(handles.axes1);
imshow(handles.data1);
else
return;
end
pushbutoon greyscale
image1 = handles.data1;
gray = rgb2gray(image1);
axes(handles.axes2);
imshow(gray);
handless.data2 = gray;
guidata(hObject,handles);
slider
gray = handles.data1;
value = get(handles.slider1,'value');
thresh = imcomplement(im2bw(gray,value/255));
axes(handles.axes2);
imshow(thresh);
handles.data3 = thresh;
guidata(hObject,handles);
set(handles.edit1,'string',value)
pushbutoon save
thresh = handles.data3;
[name_file_save,path_save] = uiputfile(...
{'*.bmp','File Bitmap (*.bmp)';...
'*.jpg','File jpeg (*.jpg)';
'*.tif','File Tif (*.tif)';
'*.*','All File (*.*)'},...
'Save Image');
if ~isequal(name_file_save,0)
imwrite(thresh,fullfile(path_save,name_file_save));
else
return
end
pusbutoon exit
close;
ini hasil dari program tersebut :