- SimpleCV Shell
- Videos & Tutorials
- SimpleCV on Mobile - Android
- Troubleshooting Installation
Make computers see with SimpleCV, the Open Source Framework for Computer Vision
SimpleCV is a framework for Open Source Machine Vision, using OpenCV and the Python programming language.
It provides a concise, readable interface for cameras, image manipulation, feature extraction, and format conversion. Our mission is to give casual users a comprehensive interface for basic machine vision functions and an elegant programming interface for advanced users.
We like SimpleCV because:
- Even beginning programmers can write simple machine vision tests
- Cameras, video files, images, and video streams are all interoperable
- Information on image features can be extracted, sorted and filtered easily
- Manipulations are fast, with easy to remember names
- Linear algebra is strictly optional
Here is the simplecv "hello world":
import SimpleCV camera = SimpleCV.Camera() image = camera.getImage() image.show()
The easiest way to install SimpleCV is with the packages for your distribution (Windows, Mac, Linux) included on the website (http://www.simplecv.org). Although it is tested on many platforms there maybe scenarios where it just won't work with the package installer. Below is instructions on how to install, if you have problems please see the troubleshooting section at the end of this README file.
sudo apt-get install ipython python-opencv python-scipy python-numpy python-pygame python-setuptools python-pip sudo pip install https://github.com/ingenuitas/SimpleCV/zipball/master
then just run 'simplecv' from the shell.
This is how to install SimpleCV under a python virtual environment virtualenv. This maybe useful in cases where you want to keep your system libraries clean and not install extra libraries. This method has only been tested on Ubuntu 12.04, it maybe possible to port to other operating systems.
Run the following commands:
sudo apt-get install python-opencv python-setuptools python-pip gfortran g++ liblapack-dev libsdl1.2-dev libsmpeg-dev mercurial sudo pip install virtualenv virtualenv venv cd venv mkdir src ln -s /usr/local/lib/python2.7/dist-packages/cv2.so lib/python2.7/site-packages/cv2.so ln -s /usr/local/lib/python2.7/dist-packages/cv.py lib/python2.7/site-packages/cv.py ./bin/pip install https://github.com/numpy/numpy/zipball/master ./bin/pip install https://github.com/scipy/scipy/zipball/master ./bin/pip install PIL ./bin/pip install ipython mkdir src wget -O src/pygame.tar.gz https://bitbucket.org/pygame/pygame/get/6625feb3fc7f.tar.gz cd src tar zxvf pygame.tar.gz cd .. ./bin/python src/pygame-pygame-6625feb3fc7f/setup.py -setuptools install ./bin/pip install https://github.com/ingenuitas/SimpleCV/zipball/master
pacman -S python2-numpy opencv2.3.1_a-4 python-pygame python2-setuptools ipython2 python2-pip pip install https://github.com/ingenuitas/SimpleCV/zipball/master
Mac OS X (10.6 and above)
General OSX Overview
Note: We originally tried to bundle all Mac dependencies in a superpack. This turned out to be extremely difficult with the many differences between versions of Mac OS. Now, with Mac, you must build from source and we will try and make it as easy as possible. Please report a bug if you have issues.
Before you do these you must install XCode from the App Store and run the installer!
- Install Xcode https://developer.apple.com/xcode/ and then run the Xcode installer.
- Install homebrew https://github.com/mxcl/homebrew/wiki/installation
- Use homebrew to install opencv, git, and the python imaging library (PIL needs the ARCHFLAGS tweak), plus the SDL dependencies for pygame
- Homebrew puts the libraries in /usr/local/lib/, which by default isn't in the python sys.path -- either add it, or link the files
- Install scipy superpack for Mac OSX http://fonnesbeck.github.com/ScipySuperpack/
- easy_install pip, install mercurial and use pip install pygame
- clone simplecv and python setup.py install
Explicit (as in every step) instructions compliments of JHawkins
Install Xcode via App Store
Start Xcode and go to Xcode >> Preferences >> Downloads >> click Install across from Command Line Tools
If Terminal is already running, shut it down and reopen it
OS X's permissions on /usr/local are too restrictive and must be changed via:
sudo chown -R `whoami` /usr/local
Install homebrew via Terminal using:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Ignore the single warning that instructs you to install Xcode's CLI tools (you did that already)
To verify that homebrew is installed correctly and working, run:
Address any errors before moving on. Remember, Google is your friend.
Note: If you run VM's on my via Parallels and run into multiple warnings related to "osxfuse" thi go to System Preferences >> FUSE for OS X >> Click Remove OSXFUSE. I can add it back later if needed.
Once the doctor tells you that you are 'raring to brew', run:
Install OpenCV via homebrew by running:
brew install opencv
Be sure to add the requested line to you ~/.bash_profile:
Source your ~/.bash_profile file so that the changes take effect:
Install Git via homebrew by running:
brew install git
Install SDL dependencies (can anyone clarify this?) via homebrew by running:
brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
Install XQuartz from https://xquartz.macosforge.org
Homebrew can't install smpeg at the time of this writing however there is a workaround:
brew tap homebrew/headonly brew install --HEAD smpeg
If you get a connection refused error, wait a minute and try again.
Install PIL via homebrew by running:
ARCHFLAGS="-arch i386 -arch x86_64" brew install PIL
Manually create a few PIL symlinks:
sudo ln -s /usr/local/lib/python2.6/site-packages/cv.so /Library/Python/2.6/site-packages/cv.so sudo ln -s /usr/local/lib/python2.6/site-packages/PIL /Library/Python/2.6/site-packages/PIL sudo ln -s /usr/local/lib/python2.6/site-packages/cv2.so /Library/Python/2.6/site-packages/cv2.so sudo ln -s /usr/local/lib/python2.6/site-packages/cv.py /Library/Python/2.6/site-packages/cv.py
Install PIP by running:
sudo easy_install pip
Install the Scipy Superpack from http://fonnesbeck.github.com/ScipySuperpack/
Install Mercurial via homebrew by running:
brew install mercurial
Install pygame via PIP by running:
sudo pip install hg+http://bitbucket.org/pygame/pygame
Note: SimpleCV's developers made a change (for the better) here that I am including, however everything up to this point is 100% guaranteed to work, because it's exactly what I did. Keeping true to that, I'll present both options. We both suggest using the develop branch.
Developer's Instructions Install SimpleCV from the git repo and then run setup.
git clone https://github.com/ingenuitas/SimpleCV.git cd SimpleCV/ sudo python setup.py install
JHawkins' Instructions Install SimpleCV via PIP by running:
sudo pip install https://github.com/ingenuitas/SimpleCV/zipball/master
Test by running simplecv in the command line:
If it starts (it should!) be sure to check out:
Lion Take Two
For lion make sure you install Mercurial (aka hg - brew install hg). There may be errors in pygame associated with not installing X11, if you encounter this problem please submit an issue on github. Commands (for Lion)::
mkdir ~/Code cd ~/Code /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)" brew install opencv brew install git brew tap homebrew/headonly brew install --HEAD smpeg brew install sdl sdl_image sdl_mixer sdl_ttf portmidi ARCHFLAGS="-arch i386 -arch x86_64" brew install PIL ln -s /usr/local/lib/python2.7/site-packages/cv.so /Library/Python/2.7/site-packages/cv.so sudo ln -s /usr/local/lib/python2.7/site-packages/PIL /Library/Python/2.7/site-packages/PIL sudo ln -s /usr/local/lib/python2.7/site-packages/cv2.so /Library/Python/2.7/site-packages/cv2.so sudo ln -s /usr/local/lib/python2.7/site-packages/cv.py /Library/Python/2.7/site-packages/cv.py sudo easy_install pip brew install hg sudo pip install hg+http://bitbucket.org/pygame/pygame curl -sO https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh && source install_superpack.sh pip install https://github.com/ingenuitas/SimpleCV/zipball/master
Commands (for Snow Leopard)::
mkdir ~/Code cd ~/Code ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go) brew install opencv brew install git brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi ARCHFLAGS="-arch i386 -arch x86_64" brew install PIL ln -s /usr/local/lib/python2.6/site-packages/cv.so /Library/Python/2.6/site-packages/cv.so sudo ln -s /usr/local/lib/python2.6/site-packages/PIL /Library/Python/2.6/site-packages/PIL sudo ln -s /usr/local/lib/python2.6/site-packages/cv2.so /Library/Python/2.6/site-packages/cv2.so sudo ln -s /usr/local/lib/python2.6/site-packages/cv.py /Library/Python/2.6/site-packages/cv.py sudo easy_install pip brew install hg sudo pip install https://bitbucket.org/pygame/pygame/get/6625feb3fc7f.zip curl -sO https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh | source install_superpack.sh pip install https://github.com/ingenuitas/SimpleCV/zipball/master
If you want a streamlined install which gives you all the dependencies, we recommend using the Windows Superpack, available at http://www.simplecv.org/download/
If you already have Python, OpenCV or SciPy installed and want to keep things the way you like them, follow the directions below
Install Prerequisties if they aren't already installed on your system:
- Install Python 2.7: http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi
- Install Python Setup Tools for Windows: http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe
- Install the SciPy superpack: http://sourceforge.net/projects/scipy/files/scipy/0.9.0rc5/scipy-0.9.0rc5-win32-superpack-python2.7.exe/download
- Install the NumPy superpack: http://sourceforge.net/projects/numpy/files/NumPy/1.6.2/numpy-1.6.2-win32-superpack-python2.7.exe/download
- Install Pygame for windows: http://pygame.org/ftp/pygame-1.9.1.win32-py2.7.msi
- Download OpenCV 2.3 Superpack: http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.3.1/OpenCV-2.3.1-win-superpack.exe/download
Run the executable file and when it ask where to extract to use::
(OPTIONAL) Install MinGW for optional files and building openCV from source. Make sure to include C/C++ Compiler and msys package. (http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/)
Once these are installed you need to add Python to your Path, open a command line (start->run->cmd)::
SETX PATH C:/Python27/;C:/Python27/Scripts/;C:/OpenCV2.3/opencv/build/x86/vc10/bin/;%PATH% SETX PYTHONPATH C:/OpenCV2.3/opencv/build/python/2.7/;%PYTHONPATH%
Exit the command line and reopen so it loads the updated python paths, then run::
easy_install pyreadline easy_install PIL easy_install cython easy_install pip pip install ipython pip install https://github.com/ingenuitas/SimpleCV/zipball/1.3
SimpleCV Interactive Shell, or how to run SimpleCV
Once you have SimpleCV installed, you can use it in a specialized IPython shell. This pre-loads all the symbols and gives you some extra functions and macros for using SimpleCV.
To run the SimpleCV shell, from the installation directory type:
If for some reason the shell doesn't start, you can always do so manually by running:
python -c "import SimpleCV.Shell;SimpleCV.Shell.main()"
To run SimpleCV within an ipython notebook (ipython-notebooks are required to be installed):
to install ipython notebooks run the following:
sudo pip install tornado
sudo pip install pyzmq
Videos - Tutorials and Demos
Video tutorials and demos can be found at: http://www.simplecv.org/learn/
SimpleCV on Mobile (Android)
SimpleCV can in fact be used on a mobile device. Although the processing requires a server to be setup that runs SimpleCV our 2012 Google Summer of Code student had built, we have forked the project and instructions on how to set it up and run it can be found at: https://github.com/ingenuitas/simplecv-mobile-camera
You can always head over to the SimpleCV help forums to ask questions: (SimpleCV Help Forums) - http://help.simplecv.org
Troubleshooting installation problems.
If for some reason the standard installation methods do not work you may have to manually install some or all of the dependencies required by SimpleCV.
The installation instructions below should explain more on how to install. They can also be installed manually.
- Python 2.6+ (http://www.python.org)
- SciPy (http://www.scipy.org)
- NumPy (http://numpy.scipy.org)
- Pygame (http://www.pygame.org)
- OpenCV 2.3+ (http://opencv.org)
- IPython 10+ (http://ipython.org)
- PIL 1.1.7+ (http://www.pythonware.com/products/pil/)
These libraries are NOT required to run or use SimpleCV but are needed for some of the examples if they are ran. Some of these may be included in your systems software manager or app store.
- freenect (http://openkinect.org)
- python nose
- zbar (http://zbar.sourceforge.net/)
- Tesseract (http://code.google.com/p/tesseract-ocr/)
- python-tesseract (http://code.google.com/p/python-tesseract/)
- Orange (http://orange.biolab.si)