# Planar Homographies in MATLAB

I have taken an image in height 2 meters of the ground as the original image and I want to simulate another image in 50 cm's of the ground, such as the simulated image.

The focal length of my camera is 3.7 mm (f = 3.7).

I have used from planar homography: H = k'*(eye(3) - ((t*n')/d))*inv(k) for each plane in original image in MATLAB where in the camera coordinate system:

• x axis is perpendicular to buildings in the right side of the ground,
• y axis is parallel to the ground,
• and hence z axis is upward perpendicular to the ground.

The origin is camera location in original image and k is 3x3 camera calibration matrix:

[f 0 0; 0 f 0; 0 0 1]

t is the transfer matrix [0 0 -1.5], n is the normal vector of a plane, d is the plane distance to the origin, and eye(3) is camera rotation.

For example, the plane of the ground has n=[0 0 1] and d = 2, is it true?

Original image:

Simulated image:

No can do. Your scene is not not planar, nor the camera motion you want to simulate is a pure rotation about the camera's center (a "pan-tilt"). These are the only cases where an image transformation with a pure homography will yield a realistic result.

One thing you can do is select one of the planes apparent in the image, and then warp the whole image applying a homography to it - for example, you could make the left-side wall appear frontal. But your example has real parallax between the views, so it cannot be achieved with a homography.

• Thank you! Could you give me a useful link for the samples of this work? – user1117974 Jun 16 '14 at 6:45
• Here's the whole mother lode: robots.ox.ac.uk/~vgg/hzbook (upvoting and/or accepting the answer if you find it useful would be nice too ;-) – Francesco Callari Jun 16 '14 at 16:20