mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-17 13:23:46 +08:00
Flesh out viewer beta (#2086)
* Increase max_res of first proposal network * fix render statemachine logic for viewer beta * clicking on cameras in the viewer * fix fov calculation, update camera positions while training * cleanup * backup * fix configure theme * Fix theme configure for latest dev version of viser * Fix runtime errors * add set up direction button * add pause resume button * Export panel * Render tab skeleton * make responsiveness more snappy by stopping training * depth composite * start implementing viewercontrol in new viewer * refactor background img to use depth and add depth layering option * show/hide images * speed up rendering * fix crop color background * crop * rotated crops * rotated crops * transform handle on crop box * fix xyzw for crop * oriented crop export for pointclouds, not for meshes yet * Initial render panel * Fix export button * Theme tweaks * fix background issue in cropping * export rotated poisson meshe * double normals definition in export panel * Visual nits * remove tsdf from export panel * Add licenses * Fix some CI errors * Type fixes * Fix tests * Fix numpy broken * various bugfix --------- Co-authored-by: Brent Yi <yibrenth@gmail.com> Co-authored-by: terrancewang <terrance.3512@gmail.com>
This commit is contained in:
16 files changed
+1367
-162
No files matched your search
@@ -17,7 +17,8 @@ Dataset input structures.
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Union
|
||||
from typing import Union, Tuple
|
||||
import viser.transforms as vtf
|
||||
|
||||
import torch
|
||||
from jaxtyping import Float
|
||||
@@ -76,3 +77,38 @@ class SceneBox:
|
||||
xyzs = poses[..., :3, -1]
|
||||
aabb = torch.stack([torch.min(xyzs, dim=0)[0], torch.max(xyzs, dim=0)[0]])
|
||||
return SceneBox(aabb=aabb * scale_factor)
|
||||
|
||||
|
||||
@dataclass
|
||||
class OrientedBox:
|
||||
R: Float[Tensor, "3 3"]
|
||||
"""R: rotation matrix."""
|
||||
T: Float[Tensor, "3"]
|
||||
"""T: translation vector."""
|
||||
S: Float[Tensor, "3"]
|
||||
"""S: scale vector."""
|
||||
|
||||
def within(self, pts: Float[Tensor, "n 3"]):
|
||||
"""Returns a boolean mask indicating whether each point is within the box."""
|
||||
R, T, S = self.R, self.T, self.S.to(pts)
|
||||
H = torch.eye(4, device=pts.device, dtype=pts.dtype)
|
||||
H[:3, :3] = R
|
||||
H[:3, 3] = T
|
||||
H_world2bbox = torch.inverse(H)
|
||||
pts = torch.cat((pts, torch.ones_like(pts[..., :1])), dim=-1)
|
||||
pts = torch.matmul(H_world2bbox, pts.T).T[..., :3]
|
||||
|
||||
comp_l = torch.tensor(-S / 2)
|
||||
comp_m = torch.tensor(S / 2)
|
||||
mask = torch.all(torch.concat([pts > comp_l, pts < comp_m], dim=-1), dim=-1)
|
||||
return mask
|
||||
|
||||
@staticmethod
|
||||
def from_params(
|
||||
pos: Tuple[float, float, float], rpy: Tuple[float, float, float], scale: Tuple[float, float, float]
|
||||
):
|
||||
"""Construct a box from position, rotation, and scale parameters."""
|
||||
R = torch.tensor(vtf.SO3.from_rpy_radians(rpy[0], rpy[1], rpy[2]).as_matrix())
|
||||
T = torch.tensor(pos)
|
||||
S = torch.tensor(scale)
|
||||
return OrientedBox(R=R, T=T, S=S)
|
||||
Reference in new issue
Block a user