Warped ideas

I was in Rome airport not long ago, and noticed that the reflection of the striped ceiling looked warped and bent due to the non-flatness of the reflecting surface:

img_20170930_163807.jpg
What else to do when waiting in the departures lounge?

As I’m sure will be familiar to any traveller, the excruciating boredom of an airport drives the mind to wander, so here is my derivation of the underlying mirror surface structure from this image.

 

Crop.jpgLet’s first sketch out the situation we’re dealing with and formalise the problem statement. Let’s project a given pixel on my camera out, onto the mirror, and onto the ceiling surface as in the red lines below:

Setup.png

A change in viewing angle of \theta changes the physical distance I view on the ceiling by z\cos\alpha + (d_2-z\sin\alpha)\tan\theta, where \alpha is the relative inclination of the mirror surface, and d_1, d_2 are the camera-mirror and mirror-ceiling distances. One can show that

z = \frac{d_1\tan\theta}{1 - \tan\theta\tan\alpha}\frac{1}{\cos\alpha}

and therefore that z\cos\alpha + (d_2-z\sin\alpha)\tan\theta = (d_1 + d_2)\tan\theta. This is what you would expect if the mirror weren’t there, and is just a statement that light travels is straight lines!

However, if the mirror surface is angled such that the light ray is deflected by an angle \delta\theta, the part of the ceiling that I view is shifted by a distance \Delta. This is why the reflection looks warped.

Because the ceiling has a regular structure, I know what the reflection should look like, and therefore it is possible to figure out the local angle of the mirror surface, and from that the shape of the mirror.

Doing the geometry, one can show that

\Delta = \frac{d_2 - d_2\tan\theta\tan\alpha - d_1\tan\theta}{1 - \tan\theta\tan\alpha}(\tan(\theta + 2\delta\theta) - \tan\theta)

Because the mirror is far away, \theta must be quite small. Also, the warping isn’t too severe so let’s also assume \delta\theta is also small. In that case, the above horrible expression boils down to

\delta\theta \approx \frac{\Delta}{2d_2}

This is nice and simple, and in this limiting case the exact angle of the mirror doesn’t matter.

The next step is to calculate \Delta, which I will do for a single mirror. I went and manually traced out the contours of the reflection, and corrected for the perspective distortion. I also drew what the reflection would look like for a perfectly flat mirror:

There are many ways to work out the mapping between the left and right images, and this kind of problem is one I worked on quite often during my PhD.

Let’s think of the left image as being defined by the function

I_1(x,y) \approx \cos(2\pi y / \lambda)

which states that the image is approximately sinusoidal in the vertical direction, with some typical wavelength \lambda. The image on the right is instead

I_2(x,y) \approx \cos(2\pi y/\lambda + \phi(x,y))

i.e. is also sinusoidal, but distorted by an extra phase term \phi(x,y).

There are again many ways to calculate this phase term, known as the phase retrieval problem, and here I used a particular one described by Ma et al., based on something called the 2D continuous wavelet transform.

The output looks as follows:

phi

This looks about right, and shows that the image appears to shift up at the top of the image (yellow regions), and down at the bottom (blue regions). We can already then start to imagine that the mirror is bulging out at the centre.

To relate the phase \phi to the apparent image position shift \Delta, note that a change in \phi of 2\pi corresponds to a change in position by one spacing between the ceiling features \lambda, so that

\delta\theta = \frac{\phi}{2\pi}\frac{\lambda}{2d_2}

To get to the actual mirror shape, if the displacement of the mirror out of the plane as a function of position is h(x,y), then

|\nabla h| = \tan\delta\theta

and the appropriate direction to take the derivative is given by the perpendicular to the direction of the linear features in the undistorted image, which can vary with position. This sounds complicated, so here I’ll be lazy and just assume that we just need to integrate in the vertical direction, i.e. the linear features in the ceiling appear mostly horizontal. Under this assumption, we have

h(x,y) \approx \int \tan(\frac{\phi(x,y)}{2\pi}\frac{\lambda}{2d_2})\,\text{d}y

Putting in reasonable numbers d_2 \approx 5m, \lambda \approx 30cm, and assuming that the mirror is around a metre across, we do the integration and get the following.

h.png

h3d.png

So as expected, the mirror has a bit of a bulge in the centre, around 1-1.5 cm in height, but also appears to be bending backwards a bit at the bottom.

We can verify our calculations even farther. In the image below I have taken the 3D surface, plotted above, and inserted it into a 3D scene rendered in Blender, with roughly similar geometry.

Blender.png

You can see the reflection of the ceiling is very similar to that observed, which is nice.

Finally, given that everything was in Blender, it is also interesting to see how the reflection changes as the severity of the warping is increased:

AnimationThat’s all for now, if this post has spiced up time spent lounging around in an airport, you’re very welcome.

 

Advertisements

One thought on “Warped ideas

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s