フィルターのクリア

How can I get a single frame from a simulink live video input?

3 ビュー (過去 30 日間)
Jake
Jake 2012 年 8 月 20 日
コメント済み: Hamza Ashraf 2020 年 3 月 25 日
I want to take a video input in simulink (using "From Video Device" block from the Image Acquisition toolbox) and extract one frame from the video. I then want to find the location of the brightest pixel from this frame.
I know how to find the brightest pixel given an image, but I'm having trouble getting a screenshot from the video.
So far I've tried to use the "Video To Workspace" block from the Computer Vision System toolbox with it set to only grab 1 frame, but I want everything to remain in simulink and it seems like once the data is sent to the workspace I can't get it back to the simulink model. What is being sent to the workspace is exactly what I want. Is there a way to have to keep this data in simulink instead of it being sent to the workspace, or can I bring the workspace data back during the same simulation?
Essentially I'm looking for a way to turn a video into an image that can then be used in "imread" or a similar function in simulink.
Thanks

採用された回答

Kaustubha Govind
Kaustubha Govind 2012 年 9 月 7 日
I think you can put the "From Video Device" block inside a Triggered Subsystem that is triggered at the instance that you want to get the snapshot.
  1 件のコメント
Harshil Patel
Harshil Patel 2016 年 3 月 26 日
Hey! I tried using a Triggered Subsystem but its showing an error because the 'From Video Device' only takes 'real, positive numbers' as sample times whereas a Triggered Subsystem takes '-1 or inf'. Could you please suggest any other method to do the same task: Getting a single frame from live video input. It would also help me a lot if you could make a simulink model and post its image here.
Thanking You, Harshil

サインインしてコメントする。

その他の回答 (2 件)

Jesus Luevano
Jesus Luevano 2012 年 10 月 9 日
Hi, I using precisely a triggered system to get an snapshot each 3 sec in a live video, but when I send this frame to workspace, MATLAB stores for example, an struct with this dimension 240x320x94, I think the last value are the frames obtained , this mean MATLAB is storing all the frames, and not, the snapshot that I pretend.
I explain well?
my question is, how can store just this frame to workspace? can I store it into data store memory block?
regards!!!
  1 件のコメント
Kaustubha Govind
Kaustubha Govind 2012 年 10 月 10 日
So you are getting the snapshot every 3 secs? How long does the simulation run for? I'm guessing 3*94 = 282s approx.? You need to provide the trigger signal only at the instant that you want to get the snapshot instead of every 3 sec.

サインインしてコメントする。


govind malaghan
govind malaghan 2016 年 9 月 21 日
編集済み: govind malaghan 2016 年 9 月 21 日
I have attached code for matlab function block in Simulink. In the code cam is webcam object created in matlab(cam = webcam('devicename')).You need have installed USB webcam support package for the code to work.
  1 件のコメント
Hamza Ashraf
Hamza Ashraf 2020 年 3 月 25 日
sir this code of yours i used it and simulation runs for so long
i want to use it as to get one snapshot by camera and than simulation should stop
how can i do that???

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by