Skip to content

Commit

Permalink
Added frustum
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyu committed May 12, 2023
1 parent 7742837 commit 6ff08e4
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions examples/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,27 @@
from nerfvis import scene
import numpy as np
import imageio.v2 as imageio
from scipy.spatial.transform.rotation import Rotation

bulldozer = imageio.imread('bulldozer.jpg')
scene.add_cube('My cube/0', translation=[0,0,0])
R = Rotation.from_rotvec(np.pi/2 * np.array([0, 1, 0])).as_matrix()
t = np.random.randn(3) * 0.1
f = 358 / 800 * 1111
Z = 1.0
scene.add_cube('My cube/0', translation=R[:, 2] * 2, color=[1, 0, 0])
scene.add_camera_frustum('My camera/0',
r = R,
t = t,
focal_length=f,
image_width=bulldozer.shape[1],
image_height=bulldozer.shape[0],
z=Z)
scene.add_image('My bulldozer image',
bulldozer,
r = np.eye(3),
t = np.zeros(3),
focal_length=358 / 800 * 1111,
z=1.0,
r = R,
t = t,
focal_length=f,
z=Z,
opengl=False
)
scene.set_opencv()
Expand Down

0 comments on commit 6ff08e4

Please sign in to comment.