Code covered by the BSD License  

Highlights from
Affine optic flow

image thumbnail

Affine optic flow


David Young (view profile)


26 Mar 2010 (Updated )

Estimates the parameters of an affine (first-order) optic flow model from two images.

affine_flowedgedisplay(flow, im1, im2)
function affine_flowedgedisplay(flow, im1, im2)
%AFFINE_FLOWEDGEDISPLAY displays image match under affine flow
%   AFFINE_FLOWEDGEDISPLAY(FLOW, IM1, IM2) takes FLOW, a structure returned
%   by AFFINE_FLOW, and the two images that were used to estimate it. The
%   edges from the images are displayed in the current figure, using the
%   following colours:
%       green: edges from IM1
%       blue: edges from IM2
%       red: edges from IM1 after warping by the flow field
%   Good results are indicated if the red edges are close to the blue
%   edges.

% Copyright David Young 2010

w = affine_flow.warp(flow);
t = maketform('affine', w);
im1trans = imtransform_same(im1, t);

e1 = edge(im1, 'canny');
e1trans = edge(im1trans, 'canny');
e2 = edge(im2, 'canny');

% combine the edges to show them in different colours
edges(:,:,1) = 1 - (e1 | e2);
edges(:,:,2) = 1 - (e2 | e1trans);
edges(:,:,3) = 1 - (e1 | e1trans);



Contact us