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

Fix bug when trying to create a camera path in viewer #3016

Merged
merged 2 commits into from
Mar 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions nerfstudio/viewer/render_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
from typing import Dict, List, Literal, Optional, Tuple, Union

import numpy as np
import scipy
import splines
import splines.quaternion
import viser
import viser.transforms as tf
from scipy import interpolate

from nerfstudio.viewer.control_panel import ControlPanel

Expand Down Expand Up @@ -266,7 +266,7 @@ def spline_t_from_t_sec(self, time: np.ndarray) -> np.ndarray:
if self.loop:
# In the case of a loop, we pad the spline to match the start/end
# slopes.
interpolator = scipy.interpolate.PchipInterpolator(
interpolator = interpolate.PchipInterpolator(
x=np.concatenate(
[
[-(transition_times_cumsum[-1] - transition_times_cumsum[-2])],
Expand All @@ -278,7 +278,7 @@ def spline_t_from_t_sec(self, time: np.ndarray) -> np.ndarray:
y=np.concatenate([[-1], spline_indices, [spline_indices[-1] + 1]], axis=0),
)
else:
interpolator = scipy.interpolate.PchipInterpolator(x=transition_times_cumsum, y=spline_indices)
interpolator = interpolate.PchipInterpolator(x=transition_times_cumsum, y=spline_indices)

# Clip to account for floating point error.
return np.clip(interpolator(time), 0, spline_indices[-1])
Expand Down
Loading