/* --Sparse Optical Flow Demo Program-- * Written by David Stavens (david
stavens@ai
stanford
edu) */ #include #include #include #include staticconst double pi = 3
14159265358979323846; inline static double square(int a) { return a * a; } /* This is just an inline that allocates images
I did this to reduce clutter in the * actual computer vision algorithmic code
Basically it allocates the requested image * unless that image is already non-NULL
It always leaves a non-NULL image as-is even * if that image's size, depth, and/or channels are different than the request
*/ inline static void allocateOnDemand( IplImage **img, CvSize size, int depth, int channels ) { if ( *img
= NULL ) return; *img = cvCreateImage( size, depth, channels ); if ( *img == NULL ) { fprintf(stderr, "Error: Co