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