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

Implement Fisheye-GS. #398

Merged
merged 41 commits into from
Sep 26, 2024
Merged

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
@@ -55,6 +55,8 @@ class Config:
global_scale: float = 1.0
# 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 jefequien marked this pull request as ready for review September 12, 2024 00:39
@ichsan2895
Copy link

ichsan2895 commented Sep 16, 2024

Hello, thanks for this PR. Please let me ask some question:

  1. Which one dataset that get benefit of this PR? ZipNerf fisheye or ZipeNerf Undistorted or both?
    image

  2. If I convert ZipNerf fisheye dataset using colmap image_undistorter, then I train it using --camera_model fisheye. Do it get boost the quality?

Comment on lines 256 to 273
for i in range(0, width):
for j in range(0, height):
x = float(i)
y = float(j)
x1 = (x - cx) / fx
y1 = (y - cy) / fy
theta = np.sqrt(x1**2 + y1**2)
r = (
1.0
+ params[0] * theta**2
+ params[1] * theta**4
+ params[2] * theta**6
+ params[3] * theta**8
)
x2 = fx * x1 * r + width // 2
y2 = fy * y1 * r + height // 2
mapx[j, i] = x2
mapy[j, i] = y2
Copy link
Collaborator

Choose a reason for hiding this comment

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

batchify this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

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 very nice! And Let's just merge the arguments of ortho, fisheye then its good to go!

@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
2 checks passed
@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.

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.

5 participants