Viewer refactor with state sync (#212)

* initial commit for viewer refactor

* updating name change to nerfactory

* adding headers

* making the rendering fix which broke from a merge

* things are starting to work. removing old commands now

* removed prints

* cleanup

* updating state works now even for nested dictionaries

* updating state in redux. listening for state changes. trying to draw three.js now

* added drawing functionality. need to fix translation of frustums and image planes

* images and frustums drawn correctly

* fixing lint

* github actions

* back to npm

* fixing eslint

* remove package.json from root

* new favicon

* some viewer cleanup

* notebook

* fixed camera drawings speed to avoid redraw

* trying to get Leva to update

* quick fix

* synced config panel

* adding notebook

* fixing output print error
This commit is contained in:
Ethan Weber authored and GitHub committed 2022-08-02 16:02:07 -05:00
1 parent 966374474d
commit 73fedc7593
67 files changed
+2510 -14057

No files matched your search

-29
View File
@@ -20,13 +20,6 @@ from typing import Any, Dict, List, Optional, Tuple
import numpy as np
import torch
from nerfactory.cameras.cameras import (
Camera,
get_camera,
get_intrinsics_from_intrinsics_matrix,
)
from nerfactory.viewer.server.visualizer import Viewer
def get_chunks(
lst: List[float], num_chunks: Optional[int] = None, size_of_chunk: Optional[int] = None
@@ -80,25 +73,3 @@ def get_intrinsics_matrix_and_camera_to_world_h(
)
return intrinsics_matrix, camera_to_world_h
def get_camera_from_vis(vis: Viewer, name: str = "/Cameras/Main Camera", image_height: int = 100) -> Camera:
"""Caculates the specified camera object's parameters (extrinsics/intrinsics); returns associated Camera Object.
Args:
vis: viewer object
name: name of camera to calculate for. Defaults to "/Cameras/Main Camera".
image_height: height of image. Defaults to 100.
"""
data = vis[name].get_object()
if data is None:
return None
camera_object = data["object"]["object"]
intrinsics_matrix, camera_to_world_h = get_intrinsics_matrix_and_camera_to_world_h(
camera_object, image_height=image_height
)
camera_to_world = camera_to_world_h[:3, :]
intrinsics = get_intrinsics_from_intrinsics_matrix(intrinsics_matrix)
camera = get_camera(intrinsics, camera_to_world)
return camera