/SimpleSeer

The SimpleSeer Automatic Inspection Appliance

Primary LanguagePython

The SimpleSeer is a framework to create inspections and take measurements,
it uses the SimpleCV framework and MongoDB to turn any PC into a vision appliance.

Examples of command line usage:
==========================

SimpleSeer requires you to create a new project to use:
    $ simpleseer create MYPROJECT 
    $ cd MYPROJECT 

Once enabled, you can start SimpleSeer in continuous mode:

    $ cd SimpleSeer
    $ simpleseer core &
    $ simpleseer web 

To start an iPython shell:

    $ simpleseer shell (terminal shell)
    $ simpleseer notebook (web-based notebook) 

To run a script:
   
    $ simpleseer script my-commands.py

To export the last 10 images:
    
    $ simpleseer images -n 10

To rebuild the web interface:

    $ simpleseer build

To deploy to a production server (with supervisord):

    $ simpleseer deploy


Examples of shell/script usage:
==========================

To retrieve and display all captured frames at a 1 second delay:

    >>> for f in Frame.objects:
    >>>   f.image.show()
    >>>   time.sleep(1)

To list loaded inspections and measurements:

   >>> print Inspection.objects
   >>> print Measurement.objects



Installation instructions:
==========================

You must have SimpleCV installed first! http://simplecv.org

You will also need to edit (or copy and edit) default.cfg for settings
that reflect your Camera, database, and etc.

Note: You can optionally install pyfirmata to interface with an arduino

TODO: update these to include a virtualenv


Ubuntu Linux 12.04
-----------------------------------
To run the installer:

	wget https://github.com/ingenuitas/SimpleSeer/zipball/master -O SimpleSeer.zip; unzip SimpleSeer.zip; mv ingenuitas-* SimpleSeer;
	cd SimpleSeer
	sh scripts/setup.sh

or manually install with these commands from WITHIN the SimpleSeer directory:

	sudo apt-get install python-dev python-setuptools python-pip libzmq-dev nodejs npm build-essential python-gevent libevent-dev supervisor ipython-notebook swig libvpx-dev subversion python-pastescript ipython python-opencv python-scipy python-numpy python-pygame $ sudo apt-get install libamd2.2.0 libblas3gf libc6 libgcc1 libgfortran3 liblapack3gf libumfpack5.4.0 libstdc++6 build-essential gfortran libatlas-sse2-dev python-all-dev libsdl1.2-dev libsmpeg-dev
	sudo npm install -g brunch
	sudo pip install -r pip.requirements
	sudo easy_install coffeescript
	sudo python setup.py develop
	sudo mkdir /etc/simpleseer
	sudo cp `pwd`/etc/mongodb.conf /etc/
	sudo ln -s `pwd`/SimpleSeer/static/ /etc/simpleseer/static
	sudo ln -s `pwd`/etc/supervisor.conf /etc/supervisor/conf.d/supervisor.conf
	sudo ln -s `pwd`/etc/simpleseer.cfg /etc/simpleseer.cfg
	sudo ln -s `pwd`/etc/simpleseer-logging.cfg /etc/simpleseer-logging.cfg
	sudo killall supervisord
	sudo supervisord
	sudo supervisorctl start seer-dev:


*NOTE: Don't install python-pymongo from the repos as it is much too far out of date and requires 2+

Mac OS X (Using homebrew)
--------------------------------------

> brew install mongodb
> brew install zmq
> sudo easy_install pip
> sudo ARCHFLAGS="-arch i386 -arch x86_64" pip install -r pip.requirements 

(i had to check out gevent-socketio from bitbucket and comment out #setup_requires line to get it working on mac)
> hg clone https://bitbucket.org/Jeffrey/gevent-socketio
> cd gevent-socketio
> perl -pi -e "s/setup_requires/#setup_requires/" setup.py
> sudo python setup.py install

> (optional) hg clone https://bitbucket.org/tino/pyfirmata && cd pyfirmata && python setup.py install

> curl http://npmjs.org/install.sh | sh
> npm install -g brunch
> npm install -g brunch-less
> python setup.py develop
> sudo python
>>> from IPython.external.mathjax import install_mathjax
>>> install_mathjax()
=======

Install Mongo 2.1
=================
Since features are used from mongo 2.1 and not included in the repos, the following
explains how to manually install it.

	mkdir -p /tmp/mongo
	cd /tmp/mongo
	wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.1.1.tgz
	tar zxvf mongodb-linux-x86_64-2.1.1.tgz
	cd mongodb-linux-x86_64-2.1.1
	cd bin
	sudo cp * /usr/local/bin/
	sudo mkdir -p /var/lib/mongodb
	sudo mkdir -p /var/log/mongodb



Windows
--------------------------------------
Sadly installing SimpleSeer on windows is a bit more of a manually process.
You will need to have SimpleCV installed for it to run, please follow the
instructions here:

		https://github.com/ingenuitas/SimpleCV#windows-7vista

Once that is installed you will need to install the following:

		http://pypi.python.org/packages/2.7/g/gevent/gevent-0.13.8.win32-py2.7.msi
		http://git-scm.com/download/win
		http://nodejs.org/dist/v0.8.18/x64/node-v0.8.18-x64.msi
		http://miru.hk/archive/ZeroMQ-2.2.0~miru1.0-win64.exe
		https://github.com/downloads/zeromq/pyzmq/pyzmq-2.2.0.win32-py2.7.msi
		http://pandas.pydata.org/getpandas.html (get the version you need x32 or x64)


Mongo on windows:
======================================
You will need to download mongo for windows:

		http://downloads.mongodb.org/win32/mongodb-win32-x86_64-2.2.3.zip

And then follow the insructions at:

		http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/
	

You should be good to run basic SimpleSeer tasks. Some libraries may
have been added since this README has been updated and may require manually
installing libraries.