HoHoNet
HoHoNet copied to clipboard
Spherical coordinate system used in codebase
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:
where:
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
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:
But in 3d, with this choice of coordinate system, the window ends up on the left of the bed:
from https://github.com/sunset1995/HoHoNet/blob/master/assets/snapshot_depth.jpg and https://github.com/sunset1995/HoHoNet/blob/master/assets/pano_asmasuxybohhcj.png
you can multiply by -1 to get the correct projection u = (i+0.5) / W * 2 * np.pi * -1
Of course : - ) This is my suggestion.