function [ u1 u2 e ] = update_corresp( im1, im2, u1, u2, e, enh )
% (c) 2012-03-24, Martin Matousek
% Last change: $Date::                            $
%              $Revision$

clf
ax1 = axes( 'pos', [0.02 0.02 0.46 0.96] );
image( im1 )
axis equal
hold on

ax2 = axes( 'pos', [0.52 0.02 0.46 0.96] );
image( im2 )
axis equal
hold on

if( ~exist( 'enh', 'var' ) )
  enh = [];
end

update_points( ax1, u1, e, enh )
update_points( ax2, u2, e, enh )

input( 'Adjust the points and press enter...\n' );


h1 = findobj( ax1, 'tag', 'POINT' );
h2 = findobj( ax2, 'tag', 'POINT' );
  
x1 = get( h1, 'xdata' );
y1 = get( h1, 'ydata' );
i1 = get( h1, 'userdata' );
i1 = [i1{:}];


x2 = get( h2, 'xdata' );
y2 = get( h2, 'ydata' );
i2 = get( h2, 'userdata' );
i2 = [i2{:}];

u1 = [ x1{i1}; y1{i1} ];
u2 = [ x2{i2}; y2{i2} ];

h = findall( gcf, 'tag', 'EDGE' );
e = get( h, 'userdata' );
e = [ e{:} ];
e = sort( e );
e = unique( e', 'rows' )';
