Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spherical coordinate system used in codebase #6

Open
johnwlambert opened this issue Oct 8, 2021 · 3 comments
Open

Spherical coordinate system used in codebase #6

johnwlambert opened this issue Oct 8, 2021 · 3 comments

Comments

@johnwlambert
Copy link

johnwlambert commented Oct 8, 2021

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
@johnwlambert
Copy link
Author

Here is a good example of how the reflection leads to an incorrect reconstruction.

The window should be to the right of the bed, per the panorama:
image

But in 3d, with this choice of coordinate system, the window ends up on the left of the bed:
image

from https://github.com/sunset1995/HoHoNet/blob/master/assets/snapshot_depth.jpg and https://github.com/sunset1995/HoHoNet/blob/master/assets/pano_asmasuxybohhcj.png

@monschine
Copy link

you can multiply by -1 to get the correct projection
u = (i+0.5) / W * 2 * np.pi * -1

@johnwlambert
Copy link
Author

Of course : - ) This is my suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants