本文介绍了在C ++中显示,工具栏消失了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用相同的代码在Ubuntu系统中显示矩阵图像,但是最近,显示窗口突然变了蓝色,现在无法正常工作。

I have been using the same code to show a matrix image in my Ubuntu system, but recently, out of the blue, the display window automatically changed and is now not functioning properly.

对于初学者来说,显示窗口上应有的工具栏已消失,因此,我无法使用GUI保存图像,其次,我不再能够滚动以放大图像。

For starters, the tool bar that should be there on the display window had disappeared, So I can't save the image using the GUI, and secondly, I can no longer scroll to zoom into the image.

Mat dataMatrix1(2048,2048,CV_8UC1, m);
imshow( "Display window", dataMatrix1 );
waitKey(10);

这两个功能昨天都存在,有没有人知道这是怎么回事?

Both these features were there yesterday, does anyone have any idea, what's going on?

您可以在快照中看到没有工具栏

You can see in the snapshot that there is no tool bar

推荐答案

仅当您安装了带有QT GUI后端的OpenCV时,才显示工具栏(不适用于GTK )。使用QT后端安装有两种方法-

The toolbar is only present if you have OpenCV installed with a QT GUI backend (doesn't work with GTK). There are two ways to install with QT backend -


  1. 使用cmake从源代码进行构建并指定WITH_QT = ON(这是一个漫长而艰难的方法)。

  2. 一个更简单的方法对我有用-用Conda创建一个新的虚拟环境,然后在其中输入 conda install -c menpo opencv 终奌站。尝试运行代码,如果问题仍然存在,请键入以下命令- pip install --upgrade pip ,然后按 pip install opencv-contrib- python

  1. Build from source using cmake and specify WITH_QT=ON (this is the long and hard method).
  2. The easier one and the one that worked for me - create a new virtual environment with Conda and type in conda install -c menpo opencv in terminal. Try running the code and if the issue still persists, type in the following command - pip install --upgrade pip followed by pip install opencv-contrib-python

这篇关于在C ++中显示,工具栏消失了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 21:23