### Image transformer

This page shows some transformed images. The transformation takes a rectangular image and changes it into polar coordinates.

Here are some "before" and "after" images of the transformer at work!

### Trees

Before | After |

### Sunset

Before | After |

### Lightning

Before | After |

### Lake

Before | After |

### Bruges

Before | After |

### Los Angeles

Before | After |

### HMS Belfast

Before | After |

### Stonehenge

Before | After |

### Southwark Bridge

Before | After |

### San Diego

Before | After |

### London

Before | After |

### London

Before | After |

### New Jersey

Before | After |

### Palm trees

Before | After |

### Giraffes

Before | After |

### Angel of the North

Before | After |

### Botanique, Brussels

Before | After |

### Lake Geneva

Before | After |

### M&Ms store, London

Before | After |

### Palace of Fine Arts

Before | After |

### Belgrade church

Before | After |

### Trams

Before | After |

### Rue Royale

Before | After |

### Roof of Saint Marie

Before | After |

### Office building

Before | After |

### Saints

Before | After |

### St Pancras

Before | After |

### Gallery

Before | After |

### Roof

Before | After |

### CERN stairs

Before | After |

### Tangles

Before | After |

### Antwerp station

Before | After |

### Antwerp station

Before | After |

### The transformation

The transformation is actually a little more complicated than you might expect. Each pixel in the target image is mapped to a pixel from the source image according to:

\[ X = w \arctan\left(\frac{\sqrt{2}x-h}{\sqrt{2}y-h}\right) \] \[ Y = \frac{h-\sqrt{(\sqrt{2}x-h)^2+(\sqrt{2}y-h)^2}}{h}\arctan\left(\frac{\sqrt{2}x-h}{\sqrt{2}y-h}\right) \]where \((X,Y)\) is the coordinate in the source image, \((x,y)\) is the coordinate in the target image and \(w\) and \(h\) are the width and height of the source image. Here is what the transformation looks like when applied to rectangular coordinates:

make_gallery_table('Grid', 'grid') ;