Using the 'getsnapshot' function in an embedded Matlab function, within Simulink.
5 views (last 30 days)
Show older comments
Nicholas
on 21 Jun 2012
Commented: Renato Freire
on 21 Aug 2020
Hello,
I've got a small Simulink model which reads from a webcam and does a few things to the video stream. Most of the model works fine, however one of the processes I want to do requires an embedded Matlab function.
I've passed the video feed into the Matlab block, and I've tried taking a snap shot of it using the getsnapshot function, but to no avail. I get the coder error message:
Undefined function or variable 'getsnapshot'.
Any advice would be greatly appreciated, Thanks.
0 Comments
Accepted Answer
Kaustubha Govind
on 21 Jun 2012
I'm guessing that the error occurs because the (Embedded) MATLAB Function block does not support the videoinput object. How about using an (Interpreted) MATLAB Function block instead?
Also, I haven't tried this, but an even better option might be to use the From Video Device block inside a Triggered Subsystem, so that the block acquires a frame only when triggered. The output of this subsystem can then be connected to your MATLAB Function block.
1 Comment
Renato Freire
on 21 Aug 2020
Hello my name is Renato
I am trying to take several photos inside the simulink and store them. I used the From Video Device Block in series with the Triggered Subsystem and so I can take the photos, however the methods I have used so far only generate the file at the end of the simulation. In the Video To Workspace Block I can store only one photo and the last photo taken which does not help. And in To File Block, I can put all of them, however, thousands of even repeated photos. Please give me a direct practical example of what I can do to save the photos I want to keep?
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!