[英]cv2.imshow not implemented Mac python3 opencv3
I'm new to OpenCV and am having a problem with cv2.imshow. 我是OpenCV的新手,并且cv2.imshow遇到问题。 Here's my code:
这是我的代码:
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()
I get this error: 我收到此错误:
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
The call to cv2.line
seems to work. 调用
cv2.line
似乎有效。 If try cv2.waitKey(0)
without the imshow
, I get the same error. 如果尝试
cv2.waitKey(0)
没有imshow
,我得到了同样的错误。
I installed OpenCV3 with 我安装了OpenCV3
brew install --with-examples --with-contrib --with-python3 --with-qt --without-python -v opencv3
So, clearly I need to 所以,显然我需要
Rebuild the library with Windows, GTK+ 2.x or Carbon support
but I don't know how to do that and haven't been able to work that out from searching other questions. 但我不知道该怎么做,也无法通过搜索其他问题来解决。 Does anyone have any suggestions?
有没有人有什么建议?
It was a pathing problem. 这是一个问题。 In
.bash_profile
, we commented out 在
.bash_profile
,我们注释掉了
#PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
#export PATH
Then uninstalled with brew uninstall opencv3
and reinstalled with the brew command given in the original question. 然后使用
brew uninstall opencv3
卸载,并使用原始问题中给出的brew命令重新安装。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.