0

I have a Jetson NX 16GB dev kit with Jetpack 5.0.1 as OS. As a base image for my docker container I use nvcr.io/nvidia/l4t-pytorch:r34.1.1-pth1.12-py3. My opencv version inside the container is 4.5.5.

Before I start my container I run "xhost +" in the terminal. I run my container with the following flags:

docker run -it --rm \
    -v "$HOME/.Xauthority:/root/.Xauthority:rw" \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    --runtime=nvidia \
    --net=host \
    -e LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1 \
    -e DISPLAY=$DISPLAY \
    --privileged \
    my_image:latest

However, as soon as I want to use cv2.imshow() an error occurs. So I want to execute the following code:

import cv2

image = cv2.imread("/img/snapshot.png")
cv2.imshow("img", image)

and this is the output (I used QT_DEBUG_PLUGINS=1 beforehand):

QFactoryLoader::QFactoryLoader() checking directory path "/usr/bin/platforms" ...
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Aborted (core dumped)

But whats really strange,is that if I use a tool like shotwell:

apt install shotwell
shotwell /img/snapshot.png

this opens the image without any problems. I can also open a camerastream with arv-viewer. So my question is: How can I open a .png file with cv2.imshow inside my container? Is there a problem with cv2 or have I missed a library?

Thanks in advance for your help.

Cori
  • 39
  • 4

0 Answers0