問題:
jupyter notebook 上,在使用 opencv 的時候,發(fā)現(xiàn)最基本的圖片顯示會出現(xiàn)問題退盯,即捆姜,當(dāng)使用 cv2.imshow() 的時候,會導(dǎo)致
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 /feedstock_root/build_artefacts/opencv_1496434080029/work/opencv-3.2.0/modules/highgui/src/window.cpp, line 583 Traceback (most recent call last):File "<stdin>", line 1, in <module> cv2.error:/feedstock_root/build_artefacts/opencv_1496434080029/work/opencv-3.2.0/modules/highgui/src/window.cpp:583: error: (-2) 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 function cvShowImage.
在ubutnu系統(tǒng)下吏够,應(yīng)該是缺少libgtk2.0-dev 和 pkg-config,
解決方法,
第一步怔揩,通過 apt-cache 檢查默認存儲庫中是否有自己需要的包,例如脯丝,使用 apt-cache search libgtk2.0-dev商膊,沒有的話,可以先使用 sudo apt-get update來更新庫包宠进,再進行檢查晕拆,一般更新后都能找到。
第二步材蹬,使用 sudo apt install ibgtk2.0-dev pkg-config 安裝缺少的包实幕。
如果還不能解決問題的話,可以用 matplotlib.pyplot.imshow() 暫時替代圖片顯示函數(shù)堤器。