Skip to content

Conversation

@jefequien
Copy link
Contributor

@jefequien jefequien commented Sep 10, 2024

This PR follows the formulation from Fisheye-GS and implements new fisheye_proj and fisheye_proj_vjp functions. This allows gsplat to train with a wider FOV and thus achieve higher metrics on the ZipNerf dataset. The images in the ZipNerf dataset need to be preprocessed by remapping them to an ideal fisheye (equidistant) camera. This PR also implements masking during training.

berlin

Results

Alameda scene with bilateral grid, fisheye, mcmc w/ 2M (CC PSNR: 23.77)

alameda_ellipse.mp4

@jefequien jefequien marked this pull request as draft September 10, 2024 19:01
# Normalize the world space
normalize_world_space: bool = True
# Camera model
camera_model: str = "pinhole"
Copy link
Collaborator

Choose a reason for hiding this comment

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

minor note: it would be nice to use Literal["fisheye", "pinhole"] here and elsewhere!

@jefequien
Copy link
Contributor Author

@ichsan2895 Use the dataset download script to download the fisheye dataset and then run the benchmarking script.

python datasets/download_dataset.py --dataset zipnerf
bash benchmarks/fisheye/mcmc_zipnerf.sh

Copy link
Collaborator

@liruilong940607 liruilong940607 left a comment

Choose a reason for hiding this comment

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

This is super cool! Thanks for consolidating the camera_model. LGTM!

@liruilong940607 liruilong940607 merged commit 721382b into nerfstudio-project:main Sep 26, 2024
@jefequien jefequien deleted the jeff/fisheye branch September 26, 2024 22:46
@gradeeterna
Copy link

Amazing work, can't wait to try!

How can we remap our own fisheye images to an ideal fisheye equidistant camera?

I use a Samyang 8mm lens on APS-C, which is very similar to the ZipNeRF dataset (12mm fisheye on full-frame I think) and also circular fisheyes from 360 cameras, which need the black edges masked out.

Thanks!

@jefequien
Copy link
Contributor Author

The dataloader will do it automatically. You just need to use COLMAP to provide the fisheye distortion parameters.
https://colmap.github.io/cameras.html

Support for masks right now is not great. You will need to follow the code and feed your own masks into the training process.

@scott198510
Copy link

scott198510 commented Jan 9, 2025

@jefequien I follow your comments,
python datasets/download_dataset.py --dataset zipnerf
bash benchmarks/fisheye/mcmc_zipnerf.sh
The video background after my training and rendering is very dim.
What's going on? Obviously not as bright as the video you provided above, but the rendering result of the image looks normal
alameda_ellipse
nyc_ellipse
berlin_ellipse
london_ellipse
All rendering results look like very dim,

scy5335 pushed a commit to scy5335/gsplat that referenced this pull request Mar 21, 2025
* baseline

* fisheye forward works

* torch implementation of fisheye projection

* test basic

* close 0.3%

* 19 mismatched

* pass tests

* comment out

* crashing

* remove dead code

* reduce diff

* video

* distortion not handled correctly

* test remap

* remove hardcoded roi

* cleanup tests

* fix bug

* bug

* edit imsize_dict

* format c++

* T

* use mask

* remove test_remap

* mask roi

* scripts

* reduce diff

* minor

* weird ortho bug

* vectorize

* ellipse

* unify python side camera_model

* fisheye packed mode

* cuda enum

* use c++ enum

* download dataset

* refactor dataset download to download zipnerf

* use lists

* use bilateral grid as default for zipnerf
@liruilong940607
Copy link
Collaborator

liruilong940607 commented Apr 10, 2025

@szhang963 sorry just saw this. It feels normal to me to have black surroundings. That is just how fisheye barrel distortion looks like. Illustration on this page might be helpful:
https://commonlands.com/blogs/technical/wide-angle-lenses-and-fisheye-camera-lens-distortion

image

@liruilong940607
Copy link
Collaborator

@szhang963 I probably don't get why would you like to render with negative z, and unfortunately I probably don't have capacity recently too look into this.

But a quick thought is that we assume z is always positive here

float theta = glm::atan(xy_len, z + eps);

If consider z might be negative (tho i don't know why that is a valid case), we should update that line of code to

 float theta = glm::atan(xy_len, std::abs(z) + eps); 

Maybe you could try this and let me know if it resolve your issue?

@liruilong940607
Copy link
Collaborator

liruilong940607 commented Apr 10, 2025

are you using the impl from _torch_impl to render it instead of the cuda impl? If you use the rasterization function you need to fix the CUDA side of code.

@liruilong940607
Copy link
Collaborator

what would it look like if you render with pinhole?

@liruilong940607
Copy link
Collaborator

I don't have any idea on what might cause this. Maybe could start with checking if the same issue exists with pinhole camera by setting camera_model to pinhole?

@liruilong940607
Copy link
Collaborator

Thanks for doing the testing! This helps me to identify the issue: converting the depth value into bits for radixsort needs some extra care on the sign bit. should have fixed in #638

haodongw101 pushed a commit to Rajrup/gsplat that referenced this pull request Dec 20, 2025
* baseline

* fisheye forward works

* torch implementation of fisheye projection

* test basic

* close 0.3%

* 19 mismatched

* pass tests

* comment out

* crashing

* remove dead code

* reduce diff

* video

* distortion not handled correctly

* test remap

* remove hardcoded roi

* cleanup tests

* fix bug

* bug

* edit imsize_dict

* format c++

* T

* use mask

* remove test_remap

* mask roi

* scripts

* reduce diff

* minor

* weird ortho bug

* vectorize

* ellipse

* unify python side camera_model

* fisheye packed mode

* cuda enum

* use c++ enum

* download dataset

* refactor dataset download to download zipnerf

* use lists

* use bilateral grid as default for zipnerf
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.

6 participants