add_frustum question。
the box info: position=(0.0, 0.0, 1.0), dimensions=(1.0, 1.0, 1.0), the frustum info: wxyz=(1.0, 0.0, 0.0, 0.0), position=(0.0, 0.0, 0.0), fov=0.56, aspect=1920/1080, scale=1.0
so w2c and c2w is eye(4) R, T, image_width, image_height, Fovx, Fovy=w2c[:3,:3], w2c[:3,3].T,1920,1080,0.94,0.56 Then I can calculate the pixel coordinates of the eight vertices of the box. uv=K@W2C@point_in_world
the result is: 330.03644969353394,-85.9686740428812 1589.9635503064662,-85.9686740428812 330.03644969353394,1165.9686740428813 1589.9635503064662,1165.9686740428813 582.0218698161203,164.4187955742713 1337.9781301838798,164.4187955742713 582.0218698161203,915.5812044257287 1337.9781301838798,915.5812044257287
I draw the result:
but,This is different from Viser's visualization results
I am confused about the size relationship between the frustum and the box
could you help me?
this is my code: import time from pathlib import Path
import imageio.v3 as iio import numpy as onp import viser import tkinter as tk
root = tk.Tk() screen_width = root.winfo_screenwidth() screen_height = root.winfo_screenheight()
print(f"Screen resolution: {screen_width}x{screen_height}")
def main() -> None: server = viser.ViserServer()
# Add a background image.
server.scene.add_camera_frustum(
"/frustum",
wxyz=(1.0, 0.0, 0.0, 0.0),
position=(0.0, 0.0, 0.0),
fov=0.56,
aspect=1920/1080,
scale=1.0
)
server.scene.add_box(
"/box",
wxyz=(1.0, 0.0, 0.0, 0.0),
position=(0.0, 0.0, 1.0),
dimensions=(1.0, 1.0, 1.0),
color=(1.0, 0.0, 0.0),
)
time.sleep(10000)
if name == "main": main()
Hi @smart4654154! Can you see if this function/docstring helps? http://viser.studio/versions/0.2.23/scene_handles/#viser.CameraFrustumHandle.compute_canonical_frustum_size
Hi @smart4654154! Can you see if this function/docstring helps? http://viser.studio/versions/0.2.23/scene_handles/#viser.CameraFrustumHandle.compute_canonical_frustum_size
thank you
I use compute_canonical_frustum_size(),but Nothing has changed. Did I do something wrong?
this is code: a=server.scene.add_camera_frustum( "/frustum", wxyz=(1.0, 0.0, 0.0, 0.0), position=(0.0, 0.0, 0.0), fov=0.56, aspect=1920/1080, scale=1.0 ) a.compute_canonical_frustum_size()
Sorry for the delay—to clarify here, compute_canonical_frustum_size() doesn't actually modify the camera frustum. It just computes the size of the frustum.
There's an example in the doc on how to use it, you'd have to update the .scale argument manually if you want to change the size of the frustum: