Calculate optical flow using cross-correlation. Calculate optical flow using correlation, followed by lucas & kanade on aligned squares for subpixel accuracy. Locally, the closest patch within some search radius is found. The distance measure used is the euclidean distance between patches -- NOT normalized correlation since we assume pixel brightness constancy. Once the closest matching patch is found, the alignment between the two patches is further refined using lucas & kanade to find the subpixel translation vector relating the two patches. This code has been refined for speed, but since it is nonvectorized code it can be fairly slow. Running time is linear in the number of pixels but the constant is fairly large. Test on small image (150x150) before running on anything bigger. INPUTS I1, I2 - input images to calculate flow between patch_r - determines correlation patch size around each pixel search_r - search radius for corresponding patch sigma - [optional] amount to smooth by (may be 0) thr - [optional] RELATIVE reliability threshold (.01 by default) show - [optional] figure to use for display (no display if == 0) OUTPUTS Vx, Vy - x,y components of optical flow [Vx>0 -> flow is right, Vy>0 -> flow is down] reliab - reliability of optical flow in given window (cornerness of window) DATESTAMP 29-Sep-2005 2:00pm See also OPTFLOW_HORN, OPTFLOW_LUCASKANADE