|
OK, so assuming that you have a variable containing video data in the
MATLAB workspace:
>> whos vout
Name Size Bytes Class Attributes
vout 4-D 2304000 single
>> size(vout)
ans =
120 160 3 10
You can do one of several things to view it:
1) Use mplay
mplay(vout)
2) Use something more primitive
for i=1:10
image(vout(:,:,:,i));
drawnow;
end
There are more examples of this type in the documentation entitled
"Working with Images in MATLAB Graphics":
http://www.mathworks.com/access/helpdesk/help/techdoc/creating_plots/f2-145.html
Regards,
-alec
PS: I am assuming that you want to display the data from MATLAB. If you
are talking about getting the data back into same Simulink model, then
you probably don't want to use a sink block. Instead, you would just
use MATLAB code in User-Defined Function within Simulink (e.g. the Fcn,
MATLAB Fcn, or Embedded MATLAB Function blocks).
Jingwei wrote:
> Thanks again for the prompt reply! (:
>
> yupps, i know how to do that,
>
> the problem for me would be to attached the 'workspace video data' back into the GUI, maybe some sample codes or examples for the GUI .m file?
>
> been stuck on this for quite some time. ):
>
> Many Thanks! (:
>
> Jingwei
>
> Alec Rogers <alec.rogers@mathworks.com> wrote in message <hej84m$1i7$1@fred.mathworks.com>...
>> Hi Jingwei,
>>
>> As far as saving data is concerned, it doesn't really matter what the
>> source of the data is, as long as an appropriate sink is connected.
>>
>> And yes, the Video To Workspace block might work for your needs.
>>
>> If you have not already, I would encourage you to look at the following
>> demos, and try replacing the video display blocks with the Video To
>> Workspace block:
>>
>> http://www.mathworks.com/products/viprocessing/demos.html
>>
>> Several examples using video from a device are found in the section
>> "Live Video Processing".
>>
>> Regards,
>> -alec
>>
>>
>> Jingwei wrote:
>>> Hi Alec!
>>>
>>> Thanks for your response! (:
>>>
>>> for the saving of data into the MATLAB workspace, is it still possible if the video output from SIMULINK is LIVE from a video device?
>>>
>>> as you mentioned, its making use of the VIDEO-TO-WORKSPACE block in Simulink right? and writing codes in the GUI to read the data from the workspace display these back into video for the GUI?
>>>
>>> do you mind pointing me in the right direction with some coding guides? :X
>>>
>>> really appreciate it. many thanks! :D
>>>
>>> Jingwei
>>>
>>> Alec Rogers <alec.rogers@mathworks.com> wrote in message <hehhff$9hn$1@fred.mathworks.com>...
>>>> Hi Jingwei,
>>>>
>>>> If you wish to display individual video frames from Simulink in a MATLAB
>>>> figure, then you should save the data to the MATLAB workspace (as you
>>>> suggest).
>>>>
>>>> In general, the Simulink video viewers are designed to output the data
>>>> as Simulink is running, so they don't store the data.
>>>>
>>>> You can also use the To Multimedia File block to store data, which might
>>>> be a good idea if you have a large amount of video data (i.e. this would
>>>> avoid storing all of the data in the MATLAB workspace).
>>>>
>>>> Regards,
>>>> -alec
>>>>
>>>>
>>>> Jingwei wrote:
>>>>> Hello,
>>>>>
>>>>> is it possible to display the Video from a VideoViewer block in my Simulink model onto a GUI?
>>>>>
>>>>> or do i have to convert it into the MATLAB workspace and covert it back using ActiveX or Axes? i have no idea. ):
>>>>>
>>>>> the video should only play after the a button is pressed.
>>>>>
>>>>> any help will be appreciated. :D
>>>>>
>>>>> Many Thanks! (:
|