## Equirectangular Images and Gnomonic Projection¶

Lately in various domains, such as autonomous cars, surveillance systems, tourism or entertainement, there is an increasing interest in spherical images, i.e. images that record 360-degree panoramas. Spherical cameras store the omnidirectional images in two formats: equirectangular and cubic, but the former is most commonly used.

The equirectangular format is a flat image of resolution $m\times 2m$, resulted by projecting the sphere parallels as rows of pixels, and meridians as columns.

Why the equirectangular images have this particular resolution? That's because this projection is based on the unit sphere parameterization: $$r:[-\pi/2, \pi/2] \times [-\pi, \pi]\to \mathbb{R}^3,$$ defined by: $$r(\varphi, \lambda)=(x,y,z)=(\cos{\varphi}\cos{\lambda},\: \cos{\varphi}\sin{\lambda},\: \sin{\varphi}),$$ where $\varphi\in[-\pi/2, \pi/2]$ is the latitude, and $\lambda\in[-\pi, \pi]$ is the longitude. Since the sides of the rectangular region of the two parameters have the ratio 1:2, the sphere can be digitized by $m$ parallels and 2m meridians, at equal angular distances. Then, the projection

(parallel, meridian) -> (row, column),

sets up the equirectangular image.

In [1]:
import skimage.io as sio
import plotly.express as px
import numpy as np
from gnomonic import *
import plotly.io as pio
from plotly.offline import download_plotlyjs, init_notebook_mode,  iplot
init_notebook_mode(connected=True)

Example of equirectangular image

In [2]:
img = sio.imread("Images/Greece.png")
rows, cols = img.shape[:-1]
fig1 = px.imshow(img)
iplot(fig1)