sphere_snap.sphere_coor_projections

def xyz2spherical(*args, **kwargs):

Converts from 3D cartesian coordinates to spherical (phi, theta) coordinates These are the "inverse" formula of spherical2xyz().

def spherical2xyz(*args, **kwargs):

Converts from spherical coordinates (in radians) to unit sphere 3D cartesian coordinates.

def equi_coor2spherical(*args, **kwargs):

Converts from equirectangular coordinates to spherical coordinates The origin (0, 0) of the equirectangular image is in the top left corner. The input order is (horizontal, vertical). The return order is (phi, theta).

def fisheye180_coor2xyz(*args, **kwargs):

Converts from fisheye coordinates to xyz coordinates The origin (0, 0) of the fisheye image is in the top left corner. The input order is (horizontal, vertical). The return is a xyz np array.

def fisheye180_coor2spherical(*args, **kwargs):

Converts from fisheye coordinates to spherical coordinates The origin (0, 0) of the equirectangular image is in the top left corner. The input order is (horizontal, vertical). The return order is (phi, theta).

def pinhole_coor2spherical(*args, **kwargs):

Converts from perspective image plane coordinates to spherical (phi, theta) coordinates

Parameters
  • full_img_hw: a tuple containing source image size(height, width)
  • img_fov_deg: a tuple containing (hfov, vfov) of the perspective source image
  • uv: image coordinates for the 2d points on the plane we want to project
  • c_phi_theta: a tuple that contains the polar coordinates of the tangent plane center
  • plane_roll: plane roll in radians
def pinhole_spherical2coor(*args, **kwargs):

Project points from the sphere surface to a tangential plane returns the pixel's coordinates in the perspective image

Parameters
  • spherical: spherical coordinates for the sphere surface points that we want to project
  • img_fov_deg: a tuple containing (hfov, vfov) of the perspective source image
  • full_img_hw: a tuple containing source image size(height, width)
  • c_phi_theta: a tuple that contains the spherical coordinates of the tangent plane center
  • plane_roll: plane roll in radians
def equi_spherical2coor(*args, **kwargs):

For each pixel visible in the view image this function returns the pixel's coordinates in the source equirectangular image

The order of coordinates in spherical is (phi, theta). The order of coordinates in the output is (horizontal=along width, vertical=along height).

def division_model1( yx, dist_coeff, hw, np=<module 'numpy' from '/Users/andreigeorgescu/opt/miniconda3/lib/python3.9/site-packages/numpy/__init__.py'>):

Fitzgibbon division model with one parameter More details about this model can be found in the paper: https://www.robots.ox.ac.uk/~vgg/publications/papers/fitzgibbon01b.pdf

Parameters
  • yx: coordinates of the distorted pixels
  • dist_coeff: array containing distortion parameters, offset center should be normalised {lamda, center_offset_x, center_offest_y}
  • hw: image resolution
Returns

the normalized coordinates and 0 centered

def undistort(*args, **kwargs):

For each distorted image pixel yx, compute the coordinates in the undistorted image, using Fitzgibbon model with one parameter

Parameters
  • yx: coordinates of the distorted pixels
  • dist_coeff: array containing distortion parameters, offset center should be normalised {lamda, center_offset_x, center_offest_y}
  • hw: image resolution, (height, width)
  • normalize_values: if True, do min-max normalization (in [0, 1] range) of the coordinates
Returns

the coordinates in the undistorted image

def get_2D_coor_grid(*args, **kwargs):

Returns a matrix with the pixel coordinates