how to change webcam input to ipcam videoinput? i get errror in matlab program. i using ipcam app to display the video.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
function varargout = myCameraGUI(varargin)
% MYCAMERAGUI MATLAB code for mycameragui.fig
%
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @myCameraGUI_OpeningFcn, ...
'gui_OutputFcn', @myCameraGUI_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 mycameragui is made visible.
function myCameraGUI_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
url=ipcam('http://10.30.120.226:4747/video/mjpg.cgi');
% framesAcquired = 0;
% frame = snapshot(url);
% im = image(zeros(size(frame), 'uint8'));
% preview(url, im);
handles.video = url;
% handles.video = videoinput('winvideo', 1);
%
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes mycameragui wait for user response (see UIRESUME)
uiwait(handles.myCameraGUI);
% --- Outputs from this function are returned to the command line.
function varargout = myCameraGUI_OutputFcn(hObject, eventdata, handles)
% Get default command line output from handles structure
handles.output = hObject;
varargout{1} = handles.output;
% --- Executes on button press in startStopCamera.
function startStopCamera_Callback(hObject, eventdata, handles)
% Start/Stop Camera
if strcmp(get(handles.startStopCamera,'String'),'Start Camera')
% Camera is off. Change button string and start camera.
set(handles.startStopCamera,'String','Stop Camera')
start(handles.video)
set(handles.startAcquisition,'Enable','on');
set(handles.captureImage,'Enable','on');
else
% Camera is on. Stop camera and change button string.
set(handles.startStopCamera,'String','Start Camera')
stop(handles.video)
set(handles.startAcquisition,'Enable','off');
set(handles.captureImage,'Enable','off');
end
% --- Executes on button press in captureImage.
function captureImage_Callback(hObject, eventdata, handles)
% hObject handle to captureImage (see GCBO)
frame = get(get(handles.cameraAxes,'children'),'cdata'); % The current displayed frame
figure,imshow(frame);
%
folder = 'C:\Users\USER\Documents\FYP\GUI\Ripenesss_GUI\normal GUI_capture_3'; %the folder
imwrite( frame, 'image.png'); %write the image there as tif
% end
% --- Executes on button press in startAcquisition.
function startAcquisition_Callback(hObject, eventdata, handles)
ffb_ripeness_02;
%
function myCameraGUI_CloseRequestFcn(hObject, eventdata, handles)
delete(hObject);
delete(imaqfind);
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre MATLAB Support Package for IP Cameras en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!