Reputation: 441
I want to use video from following directory
'E:\Multimedia Security\matlab\UCSD_Anomaly_Dataset.v1p2\UCSDped1\Train\Train001'
Following is the code which i wrote
close all
clear all
clc
workingDir = 'E:\Multimedia
Security\matlab\UCSD_Anomaly_Dataset.v1p2\UCSDped1\Train\Train001';
videoofReader = vision.VideoFileReader(dir(fullfile(workingDir, 'abc.avi')));
videoPlayer = vision.VideoPlayer;
while ~isDone(videoofReader)
frame = step(videoofReader);
step(videoPlayer, frame);
end
release(videoofReader);
release(videoPlayer);
Error which i get is
`Error using VideoFileReader.set.Filename (line 139)
Expected Filename to be one of these types:
char
Instead its type was struct.
Error in C:\Program
Files\MATLAB\R2012a\toolbox\matlab\system\+matlab\+system\setProp.p>setProp
(line 14)
Error in
C:\ProgramFiles\MATLAB\R2012a\toolbox\matlab\system+matlab+system\SystemProp.p>SystemProp.set (line 373)
Error in C:\Program Files\MATLAB\R2012a\toolbox\matlab\system+matlab+system\SystemProp.p>SystemProp.parseInputs (line 635)
Error in C:\Program Files\MATLAB\R2012a\toolbox\matlab\system+matlab+system\SystemProp.p>SystemProp.setProperties (line 138)
Error in C:\Program Files\MATLAB\R2012a\toolbox\vision\vision+vision\VideoFileReader.p>VideoFileReader.VideoFileReader (line 131)
Error in kl2 (line 18) videoofReader = vision.VideoFileReader(dir(fullfile(workingDir, 'abc.avi')));
Upvotes: 0
Views: 206
Reputation: 46
System prompts you Error in kl2 (line 18)
so this line has a problem. You do not need to use dir
because you already have an absolute path.
Give you two solutions:
videoofReader = vision.VideoFileReader(fullfile(workingDir, 'abc.avi'));
dirstruct = dir(fullfile(workingDir, 'abc.avi'));
videoofReader = vision.VideoFileReader(dirstruct{1});
Upvotes: 1