Skip to content

Commit

Permalink
Fix bug when trying to create a camera path in viewer (nerfstudio-pro…
Browse files Browse the repository at this point in the history
…ject#3016)

* Directly import interpolate function
  • Loading branch information
MildMystery authored and Michael-Spleenlab committed Apr 26, 2024
1 parent 756585a commit 5836070
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 5836070

Please sign in to comment.