Search code examples
pycharmsimplecv

SimpleCV not working in PYCharm


I installed the superpack of SimpleCV and PyCharm. I then install the package from PyCharm for SimpleCV, and it's successful. But when I run the sample program from the official website and I get the following message:

ImportError: Cannot load OpenCV library which is required by SimpleCV

Please help me with this issue.


Solution

  • Finally, I have figured it out.

    After the superpack of SimpleCV installation is done, open the command prompt and enter the following:

    SETX PATH C:/Python27/;C:/Python27/Scripts/;C:/<DIR>/build/x86/vc10/bin/;%PATH%
    SETX PYTHONPATH C:/<DIR>/opencv/build/python/2.7/;%PYTHONPATH%
    

    Change the drive letter and DIR to the path where SimpleCV is installed on your system (Most probably C:/SimpleCV1.3/files/).

    Close the command prompt and launch PyCharm and go to settings(Ctrl+Alt+S) and navigate to Project Interpreter and on the right pane, click the green add button.

    PyCharm - Project Interpreter

    Then search for SimpleCV and install the package as shown:

    Package Installation

    Close PyCharm and download SimpleCV1.3 from GitHub and copy the sampleimages folder to C:\Python27\Lib\site-packages\SimpleCV\

    Try the following sample code, and it should work fine.

    from SimpleCV import Camera
    # Initialize the camera
    cam = Camera()
    # Loop to continuously get images
    while True:
        # Get Image from camera
        img = cam.getImage()
        # Make image black and white
        img = img.binarize()
        # Draw the text "Hello World" on image
        img.drawText("Hello World!")
        # Show the image
        img.show()
    

    Hope this helps!!