c++opencvwindows-subsystem-for-linuxmobaxterm

MobaXterm does not display the whole image received from WSL


I am using WSL1 in Windows 10 with Ubuntu 18.04 LTS.
Configured everything fine to use OpenCV with C++, but when I wanted to display an image, I always received the below error.

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.5.5-dev) /opt/opencv/modules/highgui/src/window_gtk.cpp:635: error: (-2:Unspecified error) Can't initialize GTK backend in function 'cvInitSystem'

After searching on the internet, I've found that I should use some kind of X Server to display the images, so I've installed MobaXterm to try it out. I have also added the export DISPLAY=:0.0 to the ~/.bashrc file.

Now, when I try to display my image, a window pops up, but only a part of the image is displayed.
Displayed image


Does anyone have any idea what should be the problem, why is only a part displayed of the image?
Thank's for everything in advance!

Solution

  • Maybe you can try with another option such as gWSL or XShell? If these are working, then it would be probably an issue related with MobaXterm and you can contact with the developer of this application. If the problem continues, then it should be further investigated.