Code covered by the BSD License  

Highlights from
High accuracy optical flow

image thumbnail
from High accuracy optical flow by Visesh Chari
High accuracy optical flow using a theory for warping

getalphaImg( img, alpha_cov )
function alphaImg = getalphaImg( img, alpha_cov )

% Author: Visesh Chari <visesh [at] research.iiit.net>
% Centre for Visual Information Technology
% International Institute of Information Technology
% http://cvit.iiit.ac.in/
% http://research.iiit.ac.in/~visesh
%
% The Software is provided "as is", without warranty of any kind.


if nargin < 2
	alpha_cov = 2.0 ;
end

img_g = rgb2gray( img ) ;
[ix, iy] = imgGrad( img_g ) ;

alphaImg = ix .^ 2 + iy .^ 2 ;
alphaImg = exp( -alphaImg / ( 2 * alpha_cov .^ 2 ) ) ;
alphaImg = alphaImg / sqrt( 2 * pi * alpha_cov .^ 2 ) ;

Contact us at files@mathworks.com