Matlab 计算机视觉:播放视频的途径
我想使用以下目录中的视频 'E:\Multimedia Security\matlab\UCSD\u异常\u数据集.v1p2\UCSDped1\Train\Train001' 下面是我写的代码Matlab 计算机视觉:播放视频的途径,matlab,video,computer-vision,Matlab,Video,Computer Vision,我想使用以下目录中的视频 'E:\Multimedia Security\matlab\UCSD\u异常\u数据集.v1p2\UCSDped1\Train\Train001' 下面是我写的代码 close all clear all clc workingDir = 'E:\Multimedia Security\matlab\UCSD_Anomaly_Dataset.v1p2\UCSDped1\Train\Train001'; videoofReader = vision.VideoFi
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:\程序中出现错误
Files\MATLAB\R2012a\toolbox\MATLAB\system+MATLAB+system\SystemProp.p>SystemProp.setProperties
第138行
C:\程序中出现错误
Files\MATLAB\R2012a\toolbox\vision\vision+vision\VideoFileReader.p>VideoFileReader.VideoFileReader
第131行
kl2第18行出错
videoofReader=vision.VideoFileReaderdirfullfileworkingDir,'abc.avi' 系统提示kl2第18行出现错误,因此该行有问题。您不需要使用dir,因为您已经有了绝对路径
给你两个解决方案:
videoofReader=vision.VideoFileReaderfullfileworkingDir,'abc.avi'
dirstruct=dirfullfileworkingDir,'abc.avi';
videoofReader=vision.VideoFileReaderdirstruct{1}