MaxSteel
MaxSteel

Reputation: 259

Error reading AVI files in MATLAB

I am working on extracting features from avi files using MATLAB. Every time I run the code I get an error "Exception in Reading". Code is:

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); 

What is the problem with the above code snippet?

The stack trace is as follows: For each of the 18 videos in my directory I get following error:

  [ 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.

Upvotes: 0

Views: 2087

Answers (1)

Ian Gralinski
Ian Gralinski

Reputation: 109

Apologies for not posing as a comment, but need a little more rep before I'm allowed to.

I agree with @JimInCO, it looks like you don't have VideoReader. It was first introduced in R2010b. You can try using aviread instead if you have an older version.

Upvotes: 1

Related Questions