Create Level 2 S-Function Block from .M Filfe

2 ビュー (過去 30 日間)
james
james 2014 年 11 月 19 日
コメント済み: james 2014 年 11 月 19 日
my .m file is pasted below
%%%%%%%%%%%%%%%%%%%%%%%%%%%
function showcameraonly
% Set up camera camera = cv.VideoCapture; camera.open('http://jamesquags.ddns.net/mjpg/video.mjpg')
pause(1); % Necessary in some environment. See help cv.VideoCapture
% Set up display window window = figure('KeyPressFcn',@(obj,evt)setappdata(obj,'flag',true)); setappdata(window,'flag',false);
% Start main loop while true % Grab and preprocess an image im = camera.read;
% Draw results
imshow(im);
% Terminate if any user input
flag = getappdata(window,'flag');
if isempty(flag)||flag, break; end
pause(.000000000000000000000000001);
end
% Close close(window);
end
%%%%%%%%%%%%%
This is a pretty good way to get live streaming video into Matlab for Computer Vision purposes. It references the OpenCV library and MEX files to allow Matlab to use them. This is a great method; however, it is very difficult to create a Simulink Block out of the code. I would like to create a Level 2 S-Function Block. Can anyone help me with this?
The Simulink system I would like to integrate this in is attached as a picture.
Thank you,
James

回答 (1 件)

Dima Lisin
Dima Lisin 2014 年 11 月 19 日
Hi James,
If you have the Image Acquisition Toolbox, then you can use the From Video Device block.
  1 件のコメント
james
james 2014 年 11 月 19 日
Dima,
Thank you very much for the response. Unfortunately we are working with a Power Over Ethernet IP Camera, and, as far as I know, there is no IP Camera support for Matlab. The From Video Device block does not support IP addresses.
-James

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by