2

I am trying to use multiple OpenCV windows in python on my Jetson TX2. However, I get the error: "ASSERT: "false" in file qasciikey.cpp, line 495"

Below is the minimum reproducible code:

import cv2
import numpy as np

img1=np.random.randn(300,400)
img2=np.random.randn(600,400)

cv2.imshow('win1', img1)
cv2.imshow('win2', img2)

And here is the error trace:

Could not initialize OpenGL for RasterGLSurface, reverting to RasterSurface.
QXcbConnection: XCB error: 145 (Unknown), sequence: 164, resource id: 0, major code: 139 (Unknown), minor code: 20
Could not initialize OpenGL for RasterGLSurface, reverting to RasterSurface.
ASSERT: "false" in file qasciikey.cpp, line 495
Aborted (core dumped)

Please help. Thanks!

EDIT: The error only happens when I ssh into the Jetson (via MobaXterm v10.5). If I run the code directly from the Jetson, I do not get this error.

DankMasterDan
  • 1,900
  • 4
  • 23
  • 35

3 Answers3

3

I found that un-checking "Unix-compatible keyboard" in MobaXterm/Settings/X11, with keyboard set to "us" solved this error for me.

0

I had a similar error message (ASSERT: "false" in file qasciikey.cpp, line 495) when running code on Raspberry Pi. I was able to make this problem go away by using cv2.namedWindow() first to create a window where images should be displayed.

You should try this solution and see if the problem goes away:

import cv2
import numpy as np

img1=np.random.randn(300,400)
img2=np.random.randn(600,400)

cv2.namedWindow('win1')
cv2.namedWindow('win2')

cv2.imshow('win1', img1)
cv2.imshow('win2', img2)
Fazzolini
  • 5,222
  • 2
  • 11
  • 11
0

I dont know what is the reason for this, but it happens to me when I run OpenCV with CUDA and my ubuntu latptop is running on Batteries

As soon as I connect it to the power cord, this stops happening.

KansaiRobot
  • 7,564
  • 11
  • 71
  • 150