Vedo:有没有办法在场景中添加相机并从透视图中查看图像?
Vedo: Is there a way to add a camera to scenes and see images from perspective?
我在 Python 中使用 Vedo 来可视化一些室内位置的 3D 扫描。
我想,例如,在 (0,0,0) 添加一个 'camera',向左看 90 度(或任何地方),然后查看相机的输出。
这可以用 Vedo 完成吗?如果没有,是否有不同的 python 编程框架,我可以在其中打开 .obj 文件并添加摄像头并以编程方式查看它?
您可以在嵌入式渲染器中绘制同一对象并通过简单的回调函数控制其行为:
from vedo import *
settings.immediateRendering = False # can be faster for multi-renderers
# (0,0) is the bottom-left corner of the window, (1,1) the top-right
# the order in the list defines the priority when overlapping
custom_shape = [
dict(bottomleft=(0.00,0.00), topright=(1.00,1.00), bg='wheat', bg2='w' ),# ren0
dict(bottomleft=(0.01,0.01), topright=(0.15,0.30), bg='blue3', bg2='lb'),# ren1
]
plt = Plotter(shape=custom_shape, size=(1600,800), sharecam=False)
s = ParametricShape(0) # whatever object to be shown
plt.show(s, 'Renderer0', at=0)
plt.show(s, 'Renderer1', at=1)
def update(event):
cam = plt.renderers[1].GetActiveCamera() # vtkCamera of renderer1
cam.Azimuth(1) # add one degree in azimuth
plt.addCallback("Interaction", update)
interactive()
我通常使用架构:
...
plt = Plotter(bg='bb', interactive=False)
camera = plt.camera
plt.show(actors, axes=4, viewup='y')
for i in range(360):
camera.Azimuth(1)
camera.Roll(-1)
plt.render()
...
plt.interactive().close()
祝你好运
我在 Python 中使用 Vedo 来可视化一些室内位置的 3D 扫描。
我想,例如,在 (0,0,0) 添加一个 'camera',向左看 90 度(或任何地方),然后查看相机的输出。
这可以用 Vedo 完成吗?如果没有,是否有不同的 python 编程框架,我可以在其中打开 .obj 文件并添加摄像头并以编程方式查看它?
您可以在嵌入式渲染器中绘制同一对象并通过简单的回调函数控制其行为:
from vedo import *
settings.immediateRendering = False # can be faster for multi-renderers
# (0,0) is the bottom-left corner of the window, (1,1) the top-right
# the order in the list defines the priority when overlapping
custom_shape = [
dict(bottomleft=(0.00,0.00), topright=(1.00,1.00), bg='wheat', bg2='w' ),# ren0
dict(bottomleft=(0.01,0.01), topright=(0.15,0.30), bg='blue3', bg2='lb'),# ren1
]
plt = Plotter(shape=custom_shape, size=(1600,800), sharecam=False)
s = ParametricShape(0) # whatever object to be shown
plt.show(s, 'Renderer0', at=0)
plt.show(s, 'Renderer1', at=1)
def update(event):
cam = plt.renderers[1].GetActiveCamera() # vtkCamera of renderer1
cam.Azimuth(1) # add one degree in azimuth
plt.addCallback("Interaction", update)
interactive()
我通常使用架构:
...
plt = Plotter(bg='bb', interactive=False)
camera = plt.camera
plt.show(actors, axes=4, viewup='y')
for i in range(360):
camera.Azimuth(1)
camera.Roll(-1)
plt.render()
...
plt.interactive().close()
祝你好运