image thumbnail

videoioPlayer

by

 

16 Feb 2012 (Updated )

This package contains a videoplayer class capable of viewing and processing video files in real-time

demo1(fname)
function vp = demo1(fname)

if ~exist('fname','var')
    fname = which('traffic.avi') ;
end

vp = videoioPlayer(fname,'ffmpegDirect','title', ...
    mfilename,'framesPerSecond',50) ;
vp.filter = @filterFcn ;


function img_out = filterFcn(img_in)

persistent tmp

img_in = rgb2gray(img_in) ;
[h w] = size(img_in) ;
%% init
if size(tmp,1)~=h || size(tmp,2)~=w
    tmp = zeros([size(img_in) 3],class(img_in)) ;
    tmp(:,:,2) = img_in ;
    tmp(:,:,3) = img_in ;
end
tmp(:,:,1:2) = tmp(:,:,2:3) ;
tmp(:,:,3) = img_in ;

img_out = tmp ;

Contact us