Create Level 2 S-Function Block from .M Filfe
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!