我正在使用 MATLAB 从 avi 文件中提取特征。每次运行代码时,我都会收到错误“阅读中的异常”。代码是:
cd('D:\Classified\negative-videos');
neg_files = dir('*.avi');
% compute negative files
for fileIter=1:size(neg_files,1)
tic;
movie_name = neg_files(fileIter).name;
try
[color_score__,edge_score__,spatio_score__,score__] = lg_model(movie_name,fps,3);
if(score__ < threshold)
true_neg = true_neg + 1 ;
end
if(score__ >= threshold)
false_pos = false_pos + 1 ;
end
fprintf('[ %d / %d ]\tFile : %s\tscore : %f\tcolor_score : %f\tspatio_score : %f\n', fileIter,size(neg_files,1),movie_name, score__,color_score__, spatio_score__);
catch ME1
fprintf('[ %d / %d ]\tFile : %s\t EXCEPTION IN READING \n', fileIter,size(neg_files,1),movie_name);
end
toc;
end
fprintf('INTERMEDIATE\ttrue pos = %d \n false pos = %d \n true neg = %d \n false neg = %d \n', true_pos,false_pos,true_neg, false_neg);
上面的代码片段有什么问题?
堆栈跟踪如下:对于我目录中的 18 个视频中的每一个,我都会收到以下错误:
[ 1 / 18 ] File : 38-Meter High Dive Goes Wrong.avi EXCEPTION IN READING
ME1 =
MException
Properties:
identifier: 'MATLAB:UndefinedFunction'
message: 'Undefined function or method 'VideoReader' for input arguments of type 'char'.'
cause: {}
stack: [3x1 struct]
Methods
ME1 =
MException
Properties:
identifier: 'MATLAB:UndefinedFunction'
message: 'Undefined function or method 'VideoReader' for input arguments of type 'char'.'
cause: {}
stack: [3x1 struct]
Methods
MException
Properties:
identifier: 'MATLAB:UndefinedFunction'
message: 'Undefined function or method 'VideoReader' for input arguments of type 'char'.'
cause: {}
stack: [3x1 struct]
Methods
Undefined function or method 'VideoReader' for input arguments of type 'char'.
3x1 struct array with fields:
file
name
line
MATLAB:UndefinedFunction
Elapsed time is 0.017901 seconds.