使用ZED相機實現空間建圖,產生的.obj如何視覺化問題的解決辦法
阿新 • • 發佈:2022-04-09
基於python環境下的解決方案
aconda下的處理:
基於python3.6的處理
安裝視覺化的軟體包vispy
安裝注意:
預設環境下使用pip進行安裝的是python2下的
如果在python3下安裝使用:
pip3 install vispy
如果是acconada環境下的安裝使用
conda install -c conda-forge vispy
但是發現能執行,但是無法顯示具體的影象:
能顯示影象
Python 3.8.8 (default, Apr 13 2021, 19:58:26) Type 'copyright', 'credits' or 'license' for more information IPython 7.22.0 -- An enhanced Interactive Python. Type '?' for help. PyDev console: using IPython 7.22.0 Python 3.8.8 (default, Apr 13 2021, 19:58:26) [GCC 7.3.0] on linux import vispy print(vispy.sys_info()) Platform: Linux-5.4.0-105-generic-x86_64-with-glibc2.10 Python: 3.8.8 (default, Apr 13 2021, 19:58:26) [GCC 7.3.0] NumPy: 1.20.1 Backend: PyQt5 pyqt4: None pyqt5: ('PyQt5', '5.9.2', '5.9.7') pyside: None pyside2: None pyglet: None glfw: None sdl2: None wx: None egl: EGL 1.5 NVIDIA: OpenGL_ES OpenGL osmesa: None _test: None GL version: '4.6.0 NVIDIA 510.60.02' MAX_TEXTURE_SIZE: 32768
不能顯示影象
import vispy print(vispy.sys_info()) Platform: Linux-5.4.0-105-generic-x86_64-with-Ubuntu-18.04-bionic Python: 3.6.9 (default, Mar 15 2022, 13:55:28) [GCC 8.4.0] NumPy: 1.19.5 Backend: egl pyqt4: None pyqt5: None pyqt6: None pyside: None pyside2: None pyside6: None pyglet: None glfw: None sdl2: None wx: None egl: EGL 1.5 NVIDIA: OpenGL_ES OpenGL osmesa: None tkinter: None jupyter_rfb: None _test: None GL version: '4.6.0 NVIDIA 510.60.02' MAX_TEXTURE_SIZE: 32768
對比發現,沒有關於圖形的基礎依賴
單獨安裝任意一個依賴
這裡以pyglet為例子
pip3 install --upgrade --user pyglet
安裝成功,執行程式:
from vispy import scene, io canvas = scene.SceneCanvas(keys='interactive', show=True) view = canvas.central_widget.add_view() verts, faces, normals, nothing = io.read_mesh("mesh.obj") mesh = scene.visuals.Mesh(vertices=verts, faces=faces, shading='smooth') view.add(mesh) view.camera = scene.TurntableCamera() view.camera.depth_value = 10 if __name__ == '__main__': canvas.app.run()
成功執行:
截圖如下:
uploading-image-966870.png