[英]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.