4
import cv2

img = cv2.imread('mikrotik.jpg',0)
cv2.imshow('image',img)
cv2.waitKey(0)cv2.destroyAllWindows()

I ran this code on my Pycharm on mac machine

then get this error instead

>/Users/briant/venv/bin/python /Users/briant/PycharmProjects/InputandOutput/ImageTestFile.py
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 /Users/travis/build/skvark/opencv->python/opencv/modules/highgui/src/window.cpp, line 583
    >Traceback (most recent call last):
    >  File "/Users/briant/PycharmProjects/InputandOutput/ImageTestFile.py", >line 9, 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


>Process finished with exit code 1

Could anyone please explain to me, what am I supposed to do? thank you in advance.

Briant Stevanus
  • 155
  • 2
  • 10
  • follow this http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/ – Hackaholic Apr 17 '17 at 09:22
  • 1
    The message is clear: **If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg->config** – ZdaR Apr 17 '17 at 09:40
  • Rebuild your opencv. If you don't plan to use C++, build it with `brew opencv3 --with-python`. – Quang Hoang Apr 17 '17 at 10:44
  • @QuangHoang, I already do that, but it returned me this kind of error: `Last login: Mon Apr 17 15:55:52 on ttys000 Briants-MacBook-Pro:~ briant$ brew opencv3 --with-python Error: Unknown command: opencv3 Briants-MacBook-Pro:~ briant$ brew opencv --with-python Error: Unknown command: opencv Briants-MacBook-Pro:~ briant$ brew opencv2 --with-python Error: Unknown command: opencv2 Briants-MacBook-Pro:~ briant$ ` – Briant Stevanus Apr 17 '17 at 11:30
  • 1
    my bad, it should be `brew install opencv3 --with-python`. Note the `install` command. Also it should be `opencv3` as `opencv2` is not actively developed anymore. – Quang Hoang Apr 17 '17 at 12:09
  • @QuangHoang I got this message instead: `Briants-MacBook-Pro:~ briant$ brew install python Warning: python-2.7.13 already installed, it's just not linked.` and get this instead with your latest comment: `Briants-MacBook-Pro:~ briant$ brew install opencv3 --with-python Warning: homebrew/science/opencv3 is a keg-only and another version is linked to opt. Use `brew install --force` if you want to install this version` – Briant Stevanus Apr 17 '17 at 12:16
  • Yes, and I would then link pyCharm's interpreter to brew's python. Also, if you want to use python3, you would need `brew install opencv3 --with-python3`. – Quang Hoang Apr 17 '17 at 12:20
  • `Briants-MacBook-Pro:~ briant$ brew install opencv3 --with-python3 Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). No changes to formulae.` >`Warning: homebrew/science/opencv3 is a keg-only and another version is >linked to opt. >Use `brew install --force` if you want to install this version >Briants-MacBook-Pro:~ briant$ ` should I type `brew install --force` ? @QuangHoang – Briant Stevanus Apr 17 '17 at 13:01
  • Suggest to try [Anaconda](https://www.continuum.io/downloads) if the problem is still not able to solve in 30 mins. Anaconda's Python package manager 'conda' would help to download the dependent packages to ease the installation. You may refer this [OS answer](http://stackoverflow.com/questions/43238064/opencv-version-issue/43239634#43239634) for some more information. Once Anaconda is installed, may take 10 mins, then type `install -c menpo opencv3=3.2.0` to install `OpenCV`. – thewaywewere Apr 17 '17 at 13:31

0 Answers0