| Home Introduction User's Guide Download

| FrameSub : |  |

| NAME framesub ¨C add a new frame for temporal differencing SYNOPSIS subframe = framesub(newframe , interval , thre) PARAMETERS
newframe ĦĦThe newframe to be inserted for temporal differencing
interval ĦĦThe interval of the frames for temporal differencing
thre ĦĦĦĦĦĦ The threshold for temporal differencing
subframe ĦĦThe result of the temporal differencing for the current frame.

DISCRIPTION
Function framesub adds a new frame for temporal differencing and returns the result of the temporal differencing for the current frame. The fundamental of the temporal differencing is as following:

stands for the Kth image £Ĵ stands for th image(t is the interval of the frames), stands for the subtraction of the two image:

And then choose a threshold £Ĵ thresholding £Ĵ determine the background pixels and forground pixels as following:

1 stands for forground data while 0 stands for background data.

Because the previous t frames should be recorded for the subtraction, so a list is needed.

EXAMPLE
//temporal different demo
initial_dir = PWD;
chdir (VIPDIR + 'videos');
pfi = OpenAviFile('runner.avi');
thre = 20;
interval =2;
if pfi <> []
ĦĦĦĦnew_ppavi = CreateAviFile( 'runner_temdif.avi', 100, pfi(3), pfi(4), pfi(7), pfi(8));
ĦĦĦĦdisp("waiting for writing.....");
ĦĦĦĦif new_ppavi <> []
ĦĦĦĦĦĦĦĦfor i=0:99
ĦĦĦĦĦĦĦĦĦĦĦĦdata=AviReadFrame(pfi, i);
ĦĦĦĦĦĦĦĦĦĦĦĦdata = framesub(data, interval,thre);
ĦĦĦĦĦĦĦĦĦĦĦĦAviWriteFrame(new_ppavi, data);
ĦĦĦĦĦĦĦĦĦĦĦĦdata=[];
ĦĦĦĦĦĦĦĦĦĦĦĦnew_ppavi(6)=new_ppavi(6)+1;
ĦĦĦĦĦĦĦĦend
ĦĦĦĦĦĦĦĦAviWriteEnd(new_ppavi);
ĦĦĦĦend
ĦĦĦĦAviReadEnd(pfi);
end
chdir(initial_dir);

See also

OpenAviFile, AviReadFrame, AviReadEnd, CreateAviFile, AviWriteFrame, AviWriteEnd

back

Entry
Home Introduction User's Guide
Function Reference
SIP Functions New Image Func Video Functions
Developer's Guide
Graphical Display Video Processing Modified Functions GUI
Demo
Image Processing Video Processing
Support
Future Work Known Bugs FAQ Acknowledgement About Us

|  |  | About Us | Contact Us | Our University Copyright © 2004-2005 Scilab group of Xiamen University, China |  |