2013-02-02 32 views
0

我正在使用MATLAB來從avi文件中提取功能。每次運行代碼時,我都會收到一個錯誤「Reading in Exception」。代碼是:在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. 
+0

什麼是lg_model? – johnish

+0

這是我打來的功能。 – MaxSteel

+1

它看起來像'VideoReader'沒有在您的機器上定義。它是MATLAB工具箱的一部分,你沒有? – JimInCO

回答

0

道歉不是冒充評論,但需要多一點代表我之前米允許。

我同意@JimInCO,它看起來像你沒有VideoReader。它在R2010b中首次引入。如果您的版本較舊,您可以嘗試使用aviread

+0

謝謝,我後來明白了。 VideoReader在舊版本中不可用。我更新我的Matlab到最新的它工作正常。不管怎麼說,多謝拉。 – MaxSteel