Brikut ini daftar driver yang perlu di install :
Langkah-langkah untuk menginstal driver-driver tersebut adalah:
1. Klik tool ‘Add-Ons’ pada home tool, kemudian pilih ‘Get Hardware Support Packages’

1. Klik tool ‘Add-Ons’ pada home tool, kemudian pilih ‘Get Hardware Support Packages’

2. Pilih install from internet, lalu pilih next
3. Pilih support packages yang ingin diinstal sesuai dengan tabel tersebut di atas, misalnya ‘DCAM Hardware’, kemudian pilih next
4. Log in dengan akun mathworks (bagi yang sudah punya akun). Jika belum mempunyai akun, sign up lah terlebih dahulu pada laman berikut https://www.mathworks.com/mwaccount/register?uri=/accesslogin/myAccount.do
5. Setelah log in, beri centang pada ‘I accept’, kemudian pilih next
6. Pilih next
7. Lalu pilih install
8. Install juga driver Image Acquisition Support Packages for Hardware Adaptors yang lain sesuai dengan tabel di atas.
9. Setelah semua driver-driver tersebut berhasil diinstal, maka Software Matlab telah support untuk melakukan akuisisi citra. Persiapkanlah webcam yang akan digunakan, bisa menggunakan usb webcam atau bisa juga menggunakan webcam laptop.
10. Berikut ini merupakan contoh pemrograman GUI Matlab untuk mengakuisisi citra digital menggunakan webcam:
a. Tampilan GUI awal
9. Setelah semua driver-driver tersebut berhasil diinstal, maka Software Matlab telah support untuk melakukan akuisisi citra. Persiapkanlah webcam yang akan digunakan, bisa menggunakan usb webcam atau bisa juga menggunakan webcam laptop.
10. Berikut ini merupakan contoh pemrograman GUI Matlab untuk mengakuisisi citra digital menggunakan webcam:
a. Tampilan GUI awal
b. Konfigurasi kamera, untuk webcam pilih winvideo
c.Pilih device id 1 untuk webcam laptop, pilih device id 2 untuk usb webcam
d. Pilih resolusi kamera yang diinginkan
e. Klik capture untuk menangkap sekaligus menyimpan citra hasil akuisisi
Baca : Menghitung Region Property Suatu Citra Yang di Akuisisi Dari Webcam
File GUIDE Matlab untuk akuisisi citra digital dapat diperoleh melalui halaman berikut ini: Source Code
Sedangkan tampilan source codenya adalah:
function varargout = RegionProperty(varargin)
% REGIONPROPERTY MATLAB code for RegionProperty.fig
% REGIONPROPERTY, by itself, creates a new REGIONPROPERTY or raises the existing
% singleton*.
%
% H = REGIONPROPERTY returns the handle to a new REGIONPROPERTY or the handle to
% the existing singleton*.
%
% REGIONPROPERTY('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in REGIONPROPERTY.M with the given input arguments.
%
% REGIONPROPERTY('Property','Value',...) creates a new REGIONPROPERTY or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before RegionProperty_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to RegionProperty_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 RegionProperty
% Last Modified by GUIDE v2.5 22-Oct-2018 08:44:22
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @RegionProperty_OpeningFcn, ...
'gui_OutputFcn', @RegionProperty_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 RegionProperty is made visible.
function RegionProperty_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 RegionProperty (see VARARGIN)
% Choose default command line output for RegionProperty
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes RegionProperty wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = RegionProperty_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 pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
IAHI = imaqhwinfo;
IA = (IAHI.InstalledAdaptors);
D = menu('Select Video Input Device:',IA);
if isempty(IA)||D==0
msgbox({'You don''t have any VideoInput Installed Adaptors!',...
'Please! try again and select Adaptor properly.'})
return
end
IA = char(IA);
IA = IA(D,:);
IA(IA==' ')=[];
x = imaqhwinfo(IA);
try
DeviceID = menu('Select Device ID',x.DeviceIDs);
F = x.DeviceInfo(DeviceID).SupportedFormats;
nF = menu('Select FORMAT',F);
Format = F{nF};
catch
warndlg({'Try Another Device or ID ';...
'You Don''t Have Installed This Device (VideoInputDevice)'})
return
end
VidObj = videoinput(IA, DeviceID, Format);
handles.VidObj = VidObj;
vidRes = get(handles.VidObj, 'VideoResolution');
nBands = get(handles.VidObj, 'NumberOfBands');
axes(handles.axes1)
hImage = image( zeros(vidRes(2), vidRes(1), nBands) );
preview(handles.VidObj, hImage)
set(VidObj,'returnedcolorspace','rgb');
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)
try
VidObj = handles.VidObj;
i = getsnapshot(VidObj);
axes(handles.axes2)
imshow(i);
imwrite(i,strcat(['zivi.jpg']))
catch
end
% --- Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
try
VidObj = handles.VidObj;
i = getsnapshot(VidObj);
axes(handles.axes2)
imshow(i);
imwrite(i,strcat(['zivi.jpg']))
catch
end
% --- Executes on button press in pushbutton11.
function pushbutton11_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
try
delete(handles.VidObj)
catch
end
axes(handles.axes1)
cla reset
set(gca,'XTick',[])
set(gca,'YTick',[])
axes(handles.axes2)
cla reset
set(gca,'XTick',[])
set(gca,'YTick',[])
axes(handles.axes3)
cla reset
set(gca,'XTick',[])
set(gca,'YTick',[])
set(handles.edit1,'String',0)
set(handles.edit2,'String',0)
set(handles.edit3,'String',0)
set(handles.edit4,'String',0)
% --- Executes on button press in pushbutton13.
function pushbutton13_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton13 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close;
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (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,'String') returns contents of edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (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,'String') returns contents of edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (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,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (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,'String') returns contents of edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (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,'String') returns contents of edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
0 Komentar untuk "Menggunakan Webcam di Matlab Untuk Proses Akuisisi Citra Digital"