I want to load a video and extract frames from it, save them and then use rgb2gray, edge detection and matching on specific frames...what will be the MATLAB commands for it??

2 ビュー (過去 30 日間)
VideoReader

採用された回答

Florian Morsch
Florian Morsch 2018 年 5 月 24 日
To load a video: videoFileReader = vision.VideoFileReader('Video.avi');
Take a frame from the video: videoFrame = step(videoFileReader);
RGB to gray: videoFrameGray = rgb2gray(videoFrame);
Edge detection (canny or sobel): sobelEdge = edge(image,'sobel'); cannyEdge = edge(image,'canny');
For matching you have to set the features yourself and then check the frames you want for the features.
  2 件のコメント
SURILA GUGLANI
SURILA GUGLANI 2018 年 5 月 24 日
Is this only for one frame?? Or will it work for Different frames altogether?
Florian Morsch
Florian Morsch 2018 年 5 月 24 日
編集済み: Florian Morsch 2018 年 5 月 24 日
If you use
videoFrame = step(videoFileReader);
thats only for one frame. If you want it for multiple frames you can use a while-loop with a condition. For example you can create a while-loop which runs as long as you video is playing. When the video is finished, the loop ends, like this:
while ~isDone(videoFileReader)
% Do something
end
Also dont forget to release the file reader and if you display it, also the video player.

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

その他の回答 (2 件)

Image Analyst
Image Analyst 2018 年 5 月 26 日
See my attached demo.

SURILA GUGLANI
SURILA GUGLANI 2018 年 5 月 26 日
Thank you.

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by