source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/zisserman/vgg_multiview/vgg_H_from_2P_plane.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1function [H] = vgg_H_from_2P_plane(P1,P2, L)
2%
3%       [H] = vgg_H_from_2P_plane(P, L)
4%       [H] = vgg_H_from_2P_plane(P1, P2, L)
5%
6%USAGE 1:
7% Returns the homography matrix from the plane whos normal is L to the
8% image whos projection matrix is P. This is useful for mapping two images
9% of a plane.
10%USAGE 2:
11% Given two camera matrices and a plane, returns the homography matrix that
12% maps points from the first camera onto the second.
13%
14%IN:
15%       P,P1,P2 - 3x4 Camera matrix
16%       L - 1x4 Plane normal
17%
18%OUT:
19%       H - 3x3 projective homography matrix mapping points from the image
20%       to the world-points on the plane. Note that
21%
22%EXAMPLE:
23%       Let P1, P2 be two projection matrices and let L be the normal to
24%       the plane then the homography H=H1*inv(H2) maps points in P2 to
25%       points in P1 where:
26%               H1=vgg_H_from_2P_plane(P1, L)
27%               H2=vgg_H_from_2P_plane(P2, L)
28%               % And this will be the resulting image:
29%               [u,v]=homflow(H, size(i1,1), size(i1,2));
30%               t=imgwarp(i1, u,v);
31%
32% An alternative is to use H = P1*vgg_H_from_P_plane(P2,L).
33
34% $Id: vgg_H_from_2P_plane.m,v 1.2 2002/02/22 22:30:55 werner Exp $
35% Yoni, Fri Apr  6 12:44:54 2001
36
37if nargin==2
38   P=P1; L=P2;
39   
40   H = P(:,1:3)*L(4) - P(:,4)*L(1:3);
41
42elseif nargin==3
43   nL=null(L);
44   H=P2*nL*inv(P1*nL);
45
46else
47   error('Wrong number of arguments');
48end
Note: See TracBrowser for help on using the repository browser.