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

Added a pytorch implementation of OmniCV's to remove equilib package usage #2350

Merged
merged 6 commits into from
Aug 21, 2023

Conversation

THE-COB
Copy link
Contributor

@THE-COB THE-COB commented Aug 17, 2023

The equilib package was under a GPL so we couldn't use it in nerfstudio since nerfstudio is MIT. I just implemented the equirectangular to perspective method from this MIT licensed library in pytorch and then used it instead.

Comment on lines 89 to 96
img: torch.Tensor, shape (batch_size, channels, height, width)
fov: int, field of view
theta: int, left/right angle
phi: int, up/down angle
hd: int, height of perspective image
wd: int, width of perspective image

return: torch.Tensor, shape (batch_size, channels, hd, wd)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow nerfstudio format for docstrings

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will fix

Comment on lines 37 to 40
axis: torch.Tensor, shape (3,)
theta: torch.float

return: torch.Tensor, shape (3, 3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow nerfstudio format for docstrings

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh oops I'll fix that soon


from nerfstudio.utils.rich_utils import CONSOLE, ItersPerSecColumn


# https://gist.github.com/fgolemo/94b5caf0e209a6e71ab0ce2d75ad3ed8
def rotation_matrix(axis: torch.Tensor, theta: torch.float) -> torch.Tensor:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this functionality already exists -

def rotation_matrix(a: Float[Tensor, "3"], b: Float[Tensor, "3"]) -> Float[Tensor, "3 3"]:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh awesome, I'll use that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it turns out the functions were different enough so I just kept the new one but renamed it to decrease confusion. The new one implements Euler-Rodriquez rotation.

@THE-COB THE-COB self-assigned this Aug 17, 2023
@THE-COB THE-COB marked this pull request as draft August 17, 2023 21:03
@THE-COB THE-COB marked this pull request as ready for review August 20, 2023 22:30
tancik
tancik previously approved these changes Aug 20, 2023
Copy link
Contributor

@tancik tancik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@tancik tancik dismissed their stale review August 20, 2023 23:29

Missing change

@tancik
Copy link
Contributor

tancik commented Aug 20, 2023

Looks good, but need to remove the library from the dependency list.

@THE-COB
Copy link
Contributor Author

THE-COB commented Aug 20, 2023

Looks good, but need to remove the library from the dependency list.

done

@tancik tancik merged commit 48135ee into main Aug 21, 2023
4 checks passed
@tancik tancik deleted the rohan/equirect-to-pers-new branch August 21, 2023 04:34
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

Successfully merging this pull request may close these issues.

None yet

2 participants