Skip to content

Spherical coordinate system used in codebase #6

@johnwlambert

Description

@johnwlambert

Hi, thanks for your excellent work and repo. Question for you -- how are you defining your spherical coordinate system? From the code below, it seems you have a reflection about the y axis, since u is not negated in get_uni_sphere_xyz() (image unwraps from left to right clockwise, but theta unwraps right to left counterclockwise).

A more traditional spherical coordinate system is the one below:
image
where:
Screen Shot 2021-10-08 at 1 49 46 PM

I noted that you were using r = \rho cos(\phi), if \phi=v and \rho=1, which you call c = np.cos(v). But this doesn't match the traditional spherical coordinate system. Could you explain a bit more about your derivation? Thanks.

https://github.com/sunset1995/HoHoNet/blob/master/vis_depth.py#L7

def get_uni_sphere_xyz(H, W):
    j, i = np.meshgrid(np.arange(H), np.arange(W), indexing='ij')
    u = (i+0.5) / W * 2 * np.pi
    v = ((j+0.5) / H - 0.5) * np.pi
    z = -np.sin(v)
    c = np.cos(v)
    y = c * np.sin(u)
    x = c * np.cos(u)
    sphere_xyz = np.stack([x, y, z], -1)
    return sphere_xyz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions