Kontardo Sargon (1908521040)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Nama :Kontardo F. N.

Sargon
Nim : 1908521040
75
A. Gray scale
function open_image_pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to open_image_pushbutton (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('*.jpg;*.bmp;*.png','Select an Image File');


handles.image_file = strcat(pathname,filename);
if exist(handles.image_file) % check if image exists
handles.im_original=imread(handles.image_file); % read in the image
cla(handles.axes1,'reset'); %clear axes and reset to initial condition
axes(handles.axes1);
imshow(handles.im_original);
else % if image doesnt exist
h = msgbox('File not found!','Warning'); %display message
end
hold on;
guidata(hObject,handles);

% --- Executes on button press in gray_pushbutton.


function gray_pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to gray_pushbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
ImOri=handles.im_original;
ImG=rgb2gray(ImOri); %convert to gray
cla(handles.axes2,'reset');
axes(handles.axes2);
imshow(ImG);
hold on;

tampilan Gambar kurang besar

tampilkan bagian ini saja!

mana tampilan pixel2 nya?


Nama :Kontardo F. N. Sargon
Nim : 1908521040

B. Hitam putih
% hObject handle to open_image_pushbutton (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('*.jpg;*.bmp;*.png','Select an Image File');


handles.image_file = strcat(pathname,filename);
if exist(handles.image_file) % check if image exists
handles.im_original=imread(handles.image_file); % read in the image
cla(handles.axes1,'reset'); %clear axes and reset to initial condition
axes(handles.axes1);
imshow(handles.im_original);
else % if image doesnt exist
h = msgbox('File not found!','Warning');%display message
end
hold on;
guidata(hObject,handles);

% --- Executes on button press in pushbutton2.


function pushbutton2_Callback(hObject, eventdata, handles) apa nama function nya. Sesuaikan
% hObject handle to pushbutton2 (see GCBO) dengan nama tag nya. Ikuti diktat
% eventdata reserved - to be defined in a future version of MATLAB
% handles praktikum
structure with handles and user data (see GUIDATA)
ImOri=handles.im_original;
ImBW=im2bw(ImOri);%convert to binery , black white
cla(handles.axes2,'reset');
axes(handles.axes2);
imshow(ImBW);
hold on;

gambar kurang besar

tampilkan bagian ini saja dan


diperbesar

Usahakan cari contoh gambar


yang lain jangan sama dengan
contoh diatas (grayscale)
Nama :Kontardo F. N. Sargon
Nim : 1908521040

C. PIXEL
% hObject handle to open_image_pushbutton (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('*.jpg;*.bmp;*.png','Select an Image File');


handles.image_file = strcat(pathname,filename);
if exist(handles.image_file) % check if image exists
handles.im_original=imread(handles.image_file); % read in the image
cla(handles.axes1,'reset'); %clear axes and reset to initial condition
axes(handles.axes1);
imshow(handles.im_original);
else % if image doesnt exist
h = msgbox('File not found!','Warning');%display message
end
hold on;
guidata(hObject,handles);

% --- Executes on button press in pushbutton2.


function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
ImOri=handles.im_original;
ImBW=im2bw(ImOri);%convert to binery , black white
cla(handles.axes2,'reset');
axes(handles.axes2);
imshow(ImBW);

size(ImBW) %menampilkan ukuran dari matrik citra black white


ImBW(1:5,1:5) % menampilkan hanya 5 x 5 pixel dari koordinat (1,1) sampai
% koordinat (5,5)
ImBW(101:105,101:105) % menampilkan hanya 5 x 5 pixel dari koordinat
(101,101)
% sampai koordinat (105,105)
hold on;
Nama :Kontardo F. N. Sargon
Nim : 1908521040

You might also like