计算机视觉:播放视频的路径
Computer Vision: Path for playing video
我想使用以下目录中的视频
'E:\Multimedia Security\matlab\UCSD_Anomaly_Dataset.v1p2\UCSDped1\Train\Train001'
以下是我写的代码
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 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(行
373)
C:\Program 错误 Files\MATLAB\R2012a\toolbox\matlab\system+matlab+system\SystemProp.p>SystemProp.parseInputs
(第 635 行)
C:\Program 出错
Files\MATLAB\R2012a\toolbox\matlab\system+matlab+system\SystemProp.p>SystemProp.set属性
(第 138 行)
C:\Program 出错
Files\MATLAB\R2012a\toolbox\vision\vision+vision\VideoFileReader.p>VideoFileReader.VideoFileReader
(第 131 行)
kl2 错误(第 18 行)
videoofReader = vision.VideoFileReader(dir(fullfile(workingDir, 'abc.avi')));
系统提示you Error in kl2 (line 18)
所以这行有问题。您不需要使用 dir
因为您已经有了绝对路径。
给你两个解决方案:
videoofReader = vision.VideoFileReader(fullfile(workingDir, 'abc.avi'));
dirstruct = dir(fullfile(workingDir, 'abc.avi'));
videoofReader = vision.VideoFileReader(dirstruct{1});
我想使用以下目录中的视频
'E:\Multimedia Security\matlab\UCSD_Anomaly_Dataset.v1p2\UCSDped1\Train\Train001'
以下是我写的代码
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 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(行 373)
C:\Program 错误 Files\MATLAB\R2012a\toolbox\matlab\system+matlab+system\SystemProp.p>SystemProp.parseInputs (第 635 行)
C:\Program 出错 Files\MATLAB\R2012a\toolbox\matlab\system+matlab+system\SystemProp.p>SystemProp.set属性 (第 138 行)
C:\Program 出错 Files\MATLAB\R2012a\toolbox\vision\vision+vision\VideoFileReader.p>VideoFileReader.VideoFileReader (第 131 行)
kl2 错误(第 18 行) videoofReader = vision.VideoFileReader(dir(fullfile(workingDir, 'abc.avi')));
系统提示you Error in kl2 (line 18)
所以这行有问题。您不需要使用 dir
因为您已经有了绝对路径。
给你两个解决方案:
videoofReader = vision.VideoFileReader(fullfile(workingDir, 'abc.avi'));
dirstruct = dir(fullfile(workingDir, 'abc.avi')); videoofReader = vision.VideoFileReader(dirstruct{1});