mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-07 00:09:14 +08:00
Integrating WebRTC into viewer (#73)
* restructuring for webrtc integration * some webrtc code but not working * webrtc connects when muted * the flag is real! * updating camera in websocket bridge. moved webrtc to existing websocket connection instead of http request. need to change video track * rudimentary adding real-time imaging * added free TURN server so code works everywhere * slow rendering works during training with the viewer * fix tensor device and update default model save dir * forgot to include trainer updates * removing some code that isn't needed * quick fix to bins. not the most accurate however * cleaned up code and added some config logic * black * adding license Co-authored-by: evonneng <evonne_ng@berkeley.edu>
This commit is contained in:
1 parent
e507c97e3e
commit
bf13ed3cf3
28 files changed
+8923
-917
No files matched your search
@@ -14,14 +14,11 @@
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import sys
|
||||
import time
|
||||
|
||||
import numpy as np
|
||||
import umsgpack
|
||||
import zmq
|
||||
|
||||
from .commands import Delete, SetAnimation, SetImage, SetObject, SetProperty, SetTransform
|
||||
from .commands import Delete, SetObject, GetObject, SetImage, SetProperty, SetTransform
|
||||
from .path import Path
|
||||
|
||||
|
||||
@@ -42,19 +39,17 @@ class ViewerWindow(object):
|
||||
umsgpack.packb(cmd_data),
|
||||
]
|
||||
)
|
||||
self.client.recv()
|
||||
return self.client.recv()
|
||||
|
||||
|
||||
class Visualizer(object):
|
||||
__slots__ = ["window", "path"]
|
||||
|
||||
def __init__(self, window):
|
||||
self.window = window
|
||||
self.path = Path(("pyrad",)) # TODO(ethan): change this
|
||||
|
||||
@staticmethod
|
||||
def view_into(window, path):
|
||||
vis = Visualizer(window=window)
|
||||
vis = Visualizer(window)
|
||||
vis.path = path
|
||||
return vis
|
||||
|
||||
@@ -64,6 +59,12 @@ class Visualizer(object):
|
||||
def set_object(self, geometry, material=None):
|
||||
return self.window.send(SetObject(geometry, material, self.path))
|
||||
|
||||
def get_object(self):
|
||||
return self.window.send(GetObject(self.path))
|
||||
|
||||
def set_image(self, image):
|
||||
return self.window.send(SetImage(image, self.path))
|
||||
|
||||
def set_transform(self, matrix=np.eye(4)):
|
||||
assert matrix.shape == (4, 4)
|
||||
return self.window.send(SetTransform(matrix, self.path))
|
||||
@@ -71,12 +72,6 @@ class Visualizer(object):
|
||||
def set_property(self, key, value):
|
||||
return self.window.send(SetProperty(key, value, self.path))
|
||||
|
||||
def set_animation(self, animation, play=True, repetitions=1):
|
||||
return self.window.send(SetAnimation(animation, play=play, repetitions=repetitions))
|
||||
|
||||
def set_image(self, image):
|
||||
return self.window.send(SetImage(image, self.path))
|
||||
|
||||
def delete(self):
|
||||
return self.window.send(Delete(self.path))
|
||||
|
||||
|
||||
Reference in new issue
Block a user