3

I started to use opencv in Python. but I have some problem with that. here is my code:

image = None
image = cv2.imread('7.jpg')
if image != None:
    print("len >    " + str(len(image)))
    # show image
    cv2.imshow('image', image)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
else:
    print("Image is None")

when I run this simple code I have this error:

OpenCV Error: Unspecified error (The function is not implemented.

If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvShowImage

I checked that, but all the packages are installed. I remove them and retry to install. but that didn't work!!! what should I do...

I actually checked this Link

but when I try this command: cmake -D WITH_QT=ON .. I have this in terminal:

The source directory "/home" does not appear to contain CMakeLists.txt

what should I do?

Community
  • 1
  • 1
Ali Salehi
  • 341
  • 1
  • 4
  • 16
  • Look like you run cmake command at your home folder. You should run it inside '/your/opencv/source/build', where 'build' is a subfolder of 'source' folder – Quang Hoang Mar 22 '17 at 12:20
  • I found the directory and retry those commands in terminal. everything looks fine in terminal, but when I Run the code, it says those functions are not implemented. – Ali Salehi Mar 23 '17 at 05:12

1 Answers1

0

it seems opencv have problem with python 3 and above. I tried this code in python 2.7 and it worked

Ali Salehi
  • 341
  • 1
  • 4
  • 16
  • I got the same problem with python 2.7. It happened after installing opencv by: "pip install opencv-python" – MykolaSharhan Jul 17 '17 at 10:39
  • 1
    @NickShargan try to install opencv with [this](http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/) link. it is for ubuntu 16.04 but I'm sureit has some other tutorials for other O.S. – Ali Salehi Jul 22 '17 at 01:41