Not able to import import ogl_viewer.viewer as gl

I am using zed2i with segment anything model which is working fine . now i want to do 3d reconstruction of of object using image captured, after doing all the steps involved in downloading all the dependencies i am not able to import ogl_viewer.viewer as gl.
pip install PyOpenGl PyOpenGl_accelerate
Requirement already satisfied: PyOpenGl in c:\users\iac\anaconda3\envs\zed_env\lib\site-packages (3.1.1a1)
Requirement already satisfied: PyOpenGl_accelerate in c:\users\iac\anaconda3\envs\zed_env\lib\site-packages (3.1.6)
Note: you may need to restart the kernel to use updated packages.

import sys
import time
import pyzed.sl as sl
import pygame as pg

import ogl_viewer.viewer as gl
Traceback (most recent call last):

Cell In[7], line 6
import ogl_viewer.viewer as gl

ModuleNotFoundError: No module named ‘ogl_viewer’

import sys
import time
import pyzed.sl as sl
import ogl_viewer.viewer as gl
Traceback (most recent call last):

Cell In[8], line 4
import ogl_viewer.viewer as gl

ModuleNotFoundError: No module named ‘ogl_viewer’

i am currently running this on spyder anaconda platform, and i have created a virtual environment . How do i fix this issue

Hi,

If you took the example of our samples, there is a ogl_viewer folder alongside them. You need this folder alongside your program so that it can import it right.

Hey @alassagne thank you for the quick response. I did what you had instructed me but i am facing a new issue with open gl
runfile(‘C:/Program Files (x86)/ZED SDK/samples/spatial mapping/spatial mapping/python/ogl_viewer/viewer.py’, wdir=‘C:/Program Files (x86)/ZED SDK/samples/spatial mapping/spatial mapping/python/ogl_viewer’)
Reloaded modules: ogl_viewer.viewer

runfile(‘C:/Program Files (x86)/ZED SDK/samples/spatial mapping/spatial mapping/python/spatial_mapping.py’, wdir=‘C:/Program Files (x86)/ZED SDK/samples/spatial mapping/spatial mapping/python’)
Running Spatial Mapping sample … Press ‘q’ to quit
Traceback (most recent call last):

File ~\anaconda3\envs\ZED_Env\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
exec(code, globals, locals)

File c:\program files (x86)\zed sdk\samples\spatial mapping\spatial mapping\python\spatial_mapping.py:174
main()

File c:\program files (x86)\zed sdk\samples\spatial mapping\spatial mapping\python\spatial_mapping.py:72 in main
viewer.init(camera_parameters, pymesh, CREATE_MESH)

File C:\Program Files (x86)\ZED SDK\samples\spatial mapping\spatial mapping\python\ogl_viewer\viewer.py:236 in init
glutCreateWindow(“ZED Spatial Mapping”)

File ~\anaconda3\envs\ZED_Env\lib\site-packages\OpenGL\GLUT\special.py:73 in glutCreateWindow
return __glutCreateWindowWithExit(title, _exitfunc)

ArgumentError: argument 1: TypeError: wrong type

can you please let me know how do i solve this.

Thanks im advance

Hi,

It’s because you took an opengl viewer that was in some other code but does not work with yours. You need to adapt it a bit.

its from the same code given by zed samples

What does happen when you run the original sample ?
If you have an issue, it can also be a mismatch between your SDK version and sample version. You can ensure you have the right one by using the sample that are provided in the SDK installation folder.

The program simply does not run and mapping