Using the 'getsnapshot' function in an embedded Matlab function, within Simulink.

14 次查看(过去 30 天)
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.

采纳的回答

Kaustubha Govind
Kaustubha Govind 2012-6-21
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 个评论
Renato Freire
Renato Freire 2020-8-21
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?

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by