如何用MATLAB R2014a调用GIGE接口的监控摄像头

如何用MATLAB R2014a调用GIGE接口的监控摄像头,第1张

首先确定安装好了摄像头的驱动,打开“应用程序”>“image acquisition”查看
新建图形用户界面:“新建”>“图形用户界面”
从左侧选择控件,添加到面板
双击空间进行属性设置,“string”为显示名称,“tag”为id。将两个axes的“visable“属性设置为”off“
更改”m“文件:
function varargout = untitled1(varargin)
% UNTITLED1 MATLAB code for untitled1fig
% UNTITLED1, by itself, creates a new UNTITLED1 or raises the existing
% singleton
%
% H = UNTITLED1 returns the handle to a new UNTITLED1 or the handle to
% the existing singleton
%
% UNTITLED1('CALLBACK',hObject,eventData,handles,) calls the local
% function named CALLBACK in UNTITLED1M with the given input arguments
%
% UNTITLED1('Property','Value',) creates a new UNTITLED1 or raises the
% existing singleton Starting from the left, property value pairs are
% applied to the GUI before untitled1_OpeningFcn gets called An
% unrecognized property name or invalid value makes property application
% stop All inputs are passed to untitled1_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 untitled1
% Last Modified by GUIDE v25 12-Mar-2015 20:53:43
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename,
'gui_Singleton', gui_Singleton,
'gui_OpeningFcn', @untitled1_OpeningFcn,
'gui_OutputFcn', @untitled1_OutputFcn,
'gui_LayoutFcn', [] ,
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_Stategui_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 untitled1 is made visible
function untitled1_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 untitled1 (see VARARGIN)
% Choose default command line output for untitled1
handlesoutput = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes untitled1 wait for user response (see UIRESUME)
% uiwait(handlesfigure1);
% --- Outputs from this function are returned to the command line
function varargout = untitled1_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} = handlesoutput;
global vid;
vid = videoinput('winvideo');
%set(vid,'ReturnedColorSpace','grayscale');
function pushbutton1_Callback(hObject, eventdata, handles)
axes(handlesaxes1);
global vid;
vidRes = vidVideoResolution;
nBands = vidNumberOfBands;
hImage = image( zeros(vidRes(2), vidRes(1), nBands) );
preview(vid, hImage);
% --- 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)
axes(handlesaxes2);
global vid;
f=getsnapshot(vid);
imshow(f);
6
点击运行,单击”preview“进行预览,单击”snapshot“捕获图像

以上就是关于如何用MATLAB R2014a调用GIGE接口的监控摄像头全部的内容,包括:如何用MATLAB R2014a调用GIGE接口的监控摄像头、、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/10088464.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-05
下一篇 2023-05-05

发表评论

登录后才能评论

评论列表(0条)

保存