[英]cv2.imshow not implemented Mac python3 opencv3
我是OpenCV的新手,並且cv2.imshow遇到問題。 這是我的代碼:
import numpy as np
import cv2
print("Version is", cv2.__version__)
print("Build info", cv2.getBuildInformation())
img = cv2.imread('../coelacanth.jpeg', cv2.IMREAD_COLOR)
if img is None:
print("no image")
else:
print("there is an image")
cv2.line(img, (0,0), (150, 150), (255, 255, 255), 15)
cv2.imshow('image', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
我收到此錯誤:
line 16, in <module>
cv2.imshow('image', img)
line 16, in <module>
cv2.imshow('image', img)
cv2.error: /Users/travis/build/skvark/opencv-python/opencv/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
調用cv2.line
似乎有效。 如果嘗試cv2.waitKey(0)
沒有imshow
,我得到了同樣的錯誤。
我安裝了OpenCV3
brew install --with-examples --with-contrib --with-python3 --with-qt --without-python -v opencv3
所以,顯然我需要
Rebuild the library with Windows, GTK+ 2.x or Carbon support
但我不知道該怎么做,也無法通過搜索其他問題來解決。 有沒有人有什么建議?
這是一個問題。 在.bash_profile
,我們注釋掉了
#PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
#export PATH
然后使用brew uninstall opencv3
卸載,並使用原始問題中給出的brew命令重新安裝。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.