sphere_snap.sphere_coor_projections
Converts from 3D cartesian coordinates to spherical (phi, theta) coordinates
These are the "inverse" formula of spherical2xyz().
Converts from spherical coordinates (in radians) to unit sphere 3D cartesian coordinates.
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).
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.
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).
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
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
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).
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
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
Returns a matrix with the pixel coordinates