How to queue a list of videos for analysis?

5 vues (au cours des 30 derniers jours)
Mark Lepage
Mark Lepage le 30 Oct 2017
Hello,
I have a program written that does certain analysis on a video. However, I need to perform this analysis on many videos, thus is manually time consuming to load the next video into the program. Is there a way to queue a list of videos to be inputted in my program?
My pseudo code currently looks something like this:
obj = VideoReader('myVideo-1.MOV')
results = SOMEANALYSIS(obj)
My videos are in some form of myVideo-1, 'myVideo-2,..., myVideo-n, where n denotes the number of the video I am analysing.
Any input is appreciated.

Réponse acceptée

Mabin Mariam Joseph
Mabin Mariam Joseph le 8 Nov 2017
Hello Mark,
You can use create a 'FileDatastore' object that can hold all the video files. The 'ReadFcn' property of the datastore object is a function that reads the file data specified as a function handle. Please see the sample code below:
loc='location of the files';
fds = fileDatastore(loc,'ReadFcn',@myread,'FileExtensions','.mp4');
data = readall(fds);
function v = myread(file)
v=VideoReader(file);
end
You can also refer to the following MATLAB Documentation links for further information:
https://www.mathworks.com/help/matlab/ref/filedatastore.html
https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.readall.html
https://www.mathworks.com/help/matlab/datastore.html

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by