Hi, I developed a vision inspection software on Xavier NX. This software uses OpenCV for image process. It works well on a few of Xavier NX devices which is installed with Jetpack 4.5. But when I deployed this software on a new Xavier NX recently, I encountered a problem. The new Xavier NX is installed with Jetpack 4.6 from your download web pages. Below is the screenshot of error message:
Please take note that Line 10 is this command in the script: import cv2. This means I cannot run the compiled package on Jetpack 4.6. How can I solve such problem?
Hi,
Not sure if this is the rootcause, but if you have upgraded from Jetpack 4,5 to 4.6, probably you would need to re-compile the sample on Jetpack 4.6.
Hi Dane:
Yes, I re-complied the software on Jetpack 4.6, and run the executable on the same machine, but still cannot run it. Below is the error image:
Hi Dane or Nvidia support team:
Can you please help on this issue? I’m waiting for your response, otherwise, we cannot use the software on the new machine. Our production line await it. Thanks in advance.
nvidia@nvidia-desktop:~$ python
Python 2.7.17 (default, Feb 27 2021, 15:10:58)
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.1.1'
>>> quit()
nvidia@nvidia-desktop:~$ python3
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.1.1'
And does the sample run with python 2.7 or python 3.6?
I write my script with Pycharm. If I run it from Pytharm, it works. While if I compile it with Pyinstaller, the executable cannot run on Jetpack 4.6, but can run on Jetpack 4.5.
The error seems to indicate some OpenCV versions are mismatching but we are still checking in deep.
Will share more information with you once we find the root cause.
HI Aasta:
I installed opencv 4.5.4, and rebuilt the executable. Now there is no problem with the line of “import cv2”. The software seems work, but still have another problem with Opencv. When the software uses cv2.VideoCapture(video_source) to operate the camera, it cannot open the camera. Below is the screen shot of the error in debugging:
When I operate the camera in Python3 with following codes, the camera works:
$ gst-launch-1.0 nvarguscamerasrc sensor_id=0 ! nvoverlaysink
or
$ gst-launch-1.0 nvarguscamerasrc sensor_id=0 ! ‘video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1, format=NV12’ ! nvvidconv flip-method=0 ! ‘video/x-raw,width=960, height=616’ ! nvvidconv ! nvegltransform ! nveglglessink -e
Hi:
I have managed to install opencv 4.5.4. Now GStreamer is enabled, and I can operate camera in Pycharm. But still encountered problem when running Exe compiled by Pyinstaller.
Hi,
It looks like Pyinstaller always searches for latest version of OpenCV. The latest is 4.5.4 so it may not work by downgrading to 4.5.3. Unless there is a way to force the version in Pyinstaller. This would need other users to share experience.