• DepthAI
  • Error initializing GTK backend with OpenCV in Python program

Hello everyone,

I'm trying to run a Python program that uses OpenCV to display real-time video output. However, I'm encountering an error during the initialization of the GTK backend with OpenCV. Here's the complete error message I'm receiving:

```

cv2.error: OpenCV(4.6.0) /tmp/pip-wheel-u79916uk/opencv-python_ea2489746b3a43bfb3f2b5331b7ab47a/opencv/modules/highgui/src/window_gtk.cpp:635: error: (-2:Unspecified error) Can't initialize GTK backend in function 'cvInitSystem'

```

I've tried several solutions, including exporting the `DISPLAY=:0.0` environment variable and allowing X access with the `xhost +` command. Unfortunately, none of these measures have resolved the issue.

I'm using a Windows PC and connecting to the Raspberry Pi of the OAK-D CM4 camera via SSH.

If anyone has encountered this problem before or has any suggestions to resolve it, I would greatly appreciate any help you can provide.

Thank you in advance!

Babacar

    Hi jakaskerl

    Yes, I have enabled X11 forwarding using the command `ssh pi@luxonis.local -X`. It was working fine on my MacBook with Xquartz. However, since I switched to Windows, I've been having difficulties resolving the issue, and I can't use Xquartz on Windows.

    Do you have any other suggestions for resolving this issue with initializing the GTK backend with OpenCV on Windows?

    Thank you,

    Babacar