ubuntu opencv imshow不可用问题

  今天在采用Qt调试caffe的deploy.prototxt,在显示结果图像时,在imshow处显示错误:

OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /home/zy/work/package/opencv-3.1.0/modules/highgui/src/window.cpp, line 545

  后经多番折腾,找到原因,是因为在用cmake编译opencv时,WITH_GTK未勾选导致imshow不可用。因此解决方法如下:

找到安装opencv文件夹下的build文件夹,cd build,执行 cmake-gui ..  后边有空格加两点,启动cmake的图形界面,

在图形界面面中,将部分勾选去掉:

WITH_CUDA 不勾选;

WITH_FFMPEG 勾选(影响视频解析);

WITH_CUFFT 不勾选;

WITH_GTK 勾选(影响imshow)

WITH_TBB 勾选

BUILD_TBB 勾选

BUILD_TIFF 勾选

然后点击configure,点击generate。

然后在opencv/build目录下(即上边所说的build文件夹),在终端输入make -j8

make成功后,再输入sudo make install 

然后问题就完美地解决了

你可能感兴趣的:(Caffe,C++,caffe,opencv,imshow)