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

Laporan Pengolahan Citra Digital Menggunakan Foto Biji Jagung

This document summarizes the processing of digital images using corn kernel photos. It includes 4 sections: 1) the GUI display, 2) displays of the "jagung (2).jpg" and "20171129_080029.jpg" images and their red and green channel values, 3) the source code for image processing, and 4) functions for loading images, segmenting objects, and edge detection using Sobel filtering and morphological operations.

Uploaded by

Adap Insyiyur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Laporan Pengolahan Citra Digital Menggunakan Foto Biji Jagung

This document summarizes the processing of digital images using corn kernel photos. It includes 4 sections: 1) the GUI display, 2) displays of the "jagung (2).jpg" and "20171129_080029.jpg" images and their red and green channel values, 3) the source code for image processing, and 4) functions for loading images, segmenting objects, and edge detection using Sobel filtering and morphological operations.

Uploaded by

Adap Insyiyur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

LAPORAN PENGOLAHAN CITRA DIGITAL

MENGGUNAKAN FOTO BIJI JAGUNG

Nama : Angga Dwi P


Kelas : 7 / B-3
BIM : 141080200148
1. Tampilan GUI

2. Tampilan data gambar jagung (2).jpg, dengan nilai dari data Green.
3. Tampilan data gambar 20171129_080029.jpg, dengan nilai data RED.

4. Source code

function varargout = UtsedituasEDIT(varargin)


% UTSEDITUASEDIT MATLAB code for UtsedituasEDIT.fig
% UTSEDITUASEDIT, by itself, creates a new UTSEDITUASEDIT or raises
the existing
% singleton*.
%
% H = UTSEDITUASEDIT returns the handle to a new UTSEDITUASEDIT or the
handle to
% the existing singleton*.
%
% UTSEDITUASEDIT('CALLBACK',hObject,eventData,handles,...) calls the
local
% function named CALLBACK in UTSEDITUASEDIT.M with the given input
arguments.
%
% UTSEDITUASEDIT('Property','Value',...) creates a new UTSEDITUASEDIT
or raises the
% existing singleton*. Starting from the left, property value pairs
are
% applied to the GUI before UtsedituasEDIT_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property
application
% stop. All inputs are passed to UtsedituasEDIT_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 UtsedituasEDIT

% Last Modified by GUIDE v2.5 06-Jan-2018 21:54:49


% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @UtsedituasEDIT_OpeningFcn, ...
'gui_OutputFcn', @UtsedituasEDIT_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{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 UtsedituasEDIT is made visible.


function UtsedituasEDIT_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)
% varargin command line arguments to UtsedituasEDIT (see VARARGIN)

% Choose default command line output for UtsedituasEDIT


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

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


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = UtsedituasEDIT_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 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)
%load data
handles.output = hObject;
clc;
[fn pn]=uigetfile('*jpg','select .jpg file');
complete = strcat (pn, fn);
set (handles.figure1,'CurrentAxes',handles.axes1);
handles.I = imread(complete);
%imshow (I, 'Parent', handles.origIm);
imshow (handles.I);
guidata (hObject,handles);

%coding metode
%RGB
I = im2double (handles.I)
RED = I(:,:,1);
GREEN = I(:,:,2);
BLUE = I(:,:,3);
GY = rgb2gray(I);

cla(handles.red, 'reset');
imshow(RED, 'parent', handles.red);

cla(handles.blue, 'reset');
imshow(BLUE, 'parent', handles.blue);

cla(handles.green, 'reset');
imshow(GREEN, 'parent', handles.green);

cla(handles.axes2, 'reset');
imshow(GY, 'Parent', handles.axes2);

%Normalisasi RGB
bb=RED+GREEN+BLUE;
r1=RED./bb; g1=GREEN./bb; b1=BLUE./bb;
cla(handles.r, 'reset');
imshow(r1, 'Parent', handles.r);

cla(handles.g, 'reset');
imshow(g1, 'Parent', handles.g);

cla(handles.b, 'reset');
imshow(b1, 'Parent', handles.b);

%SOBEL DETEKSI TEPI


ED1 = edge(GY, 'sobel');
cla(handles.tepi, 'reset');
imshow(ED1, 'Parent', handles.tepi);

%morfologi
%dilasi
se90 = strel('line', 3, 90);
se0 = strel('line', 3, 0);
BWsdil = imdilate(ED1, [se90 se0]);
cla(handles.dilasi, 'reset');
imshow(ED1, 'Parent', handles.dilasi);

%filling(pengisian)
BWdfill = imfill(BWsdil, 'holes');
cla(handles.isian, 'reset');
imshow(BWdfill, 'Parent', handles.isian);

%hilang noise
seD = strel('diamond',1);
BWfinal = imerode(BWdfill,seD);
secl=strel('disk',3);
bwopen=imopen(BWfinal,secl);
cla(handles.hilang, 'reset');
imshow(bwopen, 'Parent', handles.hilang);

balik =imcomplement(bwopen);
cla(handles.ijo, 'reset');
imshow(balik, 'Parent', handles.ijo)

%segmen
[m,n] = size(bwopen);
idx = find(bwopen==1);
objek = zeros(m,n);
objek(idx) =handles.I(idx);
objek = uint8(objek);
cla(handles.segmen, 'reset');
imshow(objek, 'Parent', handles.segmen);

% --- Executes on slider movement.


function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider


% get(hObject,'Min') and get(hObject,'Max') to determine range of
slider

% --- Executes during object creation, after setting all properties.


function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.


if isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end

You might also like