Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Okay fixed an image set bug

  • Loading branch information...
commit 91fbb94d01905b2a037f48f191049705bcb37f1d 2 parents f50a2a0 + af29e04
@kscottz kscottz authored
Showing with 737 additions and 829 deletions.
  1. +0 −26 .travis.yml
  2. +60 −0 CHANGELOG.txt
  3. +82 −25 README.markdown
  4. +3 −6 SimpleCV/Camera.py
  5. +1 −2  SimpleCV/Color.py
  6. +1 −1  SimpleCV/ColorModel.py
  7. +1 −4 SimpleCV/DrawingLayer.py
  8. +0 −1  SimpleCV/Features/Blob.py
  9. +1 −2  SimpleCV/Features/Detection.py
  10. +1 −1  SimpleCV/Features/Features.py
  11. +1 −1  SimpleCV/Features/Tracking.py
  12. +181 −85 SimpleCV/ImageClass.py
  13. +23 −14 SimpleCV/Shell/Shell.py
  14. +1 −1  SimpleCV/__init__.py
  15. +24 −8 SimpleCV/base.py
  16. BIN  SimpleCV/sampleimages/FSTest.png
  17. BIN  SimpleCV/sampleimages/FSTest2.png
  18. BIN  SimpleCV/sampleimages/FSTest3.png
  19. BIN  SimpleCV/sampleimages/FSTest4.png
  20. BIN  SimpleCV/sampleimages/FSTest5.png
  21. BIN  SimpleCV/sampleimages/greenscreen.jpg
  22. BIN  SimpleCV/sampleimages/logo.png
  23. +0 −22 SimpleCV/tests/BOFTester.py
  24. +0 −98 SimpleCV/tests/DisplayTester.py
  25. +0 −292 SimpleCV/tests/MLTestSuite.py
  26. +0 −3  SimpleCV/tests/README
  27. +0 −45 SimpleCV/tests/TestFlann.py
  28. +0 −8 SimpleCV/tests/cbdata.txt
  29. BIN  SimpleCV/tests/standard/test_hough_circle1.jpg
  30. BIN  SimpleCV/tests/standard/test_hough_circle2.jpg
  31. BIN  SimpleCV/tests/standard/test_image_new_crop0.jpg
  32. BIN  SimpleCV/tests/standard/test_image_new_crop1.jpg
  33. BIN  SimpleCV/tests/standard/test_image_new_crop2.jpg
  34. BIN  SimpleCV/tests/standard/test_image_new_crop3.jpg
  35. +0 −2  SimpleCV/tests/testSystem.py
  36. +33 −11 SimpleCV/tests/tests.py
  37. +0 −1  SimpleCV/utils/cloud9
  38. +2 −1  doc/HOWTO-RELEASE.txt
  39. +3 −55 doc/conf.py
  40. +4 −7 requirements.txt
  41. +127 −27 scripts/install/ubuntu/simplecv-install.sh
  42. +2 −2 scripts/install/ubuntu/stdeb.cfg
  43. +47 −19 scripts/install/win/Building_The_Installer.rst
  44. +30 −14 scripts/install/win/install.bat
  45. +47 −0 scripts/mkvirt.py
  46. +53 −0 scripts/virtualenv-bootstrap.sh
  47. +9 −7 setup.py
  48. +0 −38 simplecv.rb
View
26 .travis.yml
@@ -1,26 +0,0 @@
-language: python
-python:
- - 2.7
-notifications:
- email: false
-# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
-before_install:
- - sudo apt-get update
- - sudo apt-get upgrade
- - sudo apt-get install libavformat-dev
- - sudo apt-get install ffmpeg
- - sudo apt-get install libcv2.1
- - sudo apt-get install libcvaux2.1
- - sudo apt-get install libhighgui2.1
- - sudo apt-get install libcv-dev
- #~ - sudo apt-get install libcvaux-dev
- #~ - sudo apt-get install libhighgui-dev
- - sudo apt-get install python-opencv
-# command to run tests, e.g. python setup.py test
-install:
- - find /usr/ | grep 'cv2.so'
- - ln -s /usr/local/lib/python2.7/dist-packages/cv2.so ~/virtualenv/usr/lib/python2.7/dist-packages/cv2.so
- - python setup.py install
-script:
-- cd SimpleCV/tests/
-- nosetests tests.py
View
60 CHANGELOG.txt
@@ -1,3 +1,63 @@
+Changes in 1.3
+-------------------------------
+* These are by no order of importance:
+
+Webp image format support added
+Read image EXIF data
+YCrCb color space added
+Image Equalize Added
+IPython notebook support added (i.e. 'simplecv notebook' from command line)
+Resize added
+Merge Color Channels Added
+Barcode library switched to zbar
+drawRectangle added
+findCircle added
+Whitebalance
+Keypoint detection and matching added (SURF, SIFT, and many others, see findKeypoints() docs)
+Optical Flow added (see findMotion() docs)
+Color Pallette generator added (see getColorPalette() docs)
+Skeletonize added
+Smart Threshold (a.k.a. Grab Cut) added, see smartThreshold() docs
+Smart Find Blobs, findBlobs using Grab Cut, see smartFindBlobs() docs
+Rewrote own Threshold function (a.k.a. Binarize), see threshold() docs
+FloodFill added
+FloodFill to mask added
+DFTFilter added
+HighPass filter added
+LowPass Filter added
+BandPass Filter added
+Butterworth Filter added
+Gaussian Filter added
+Unsharpen Filter added
+edgeIntersections added
+Contour Fitting added
+Line Fitting added
+Sobel Edge Detection Added
+CAMShift Tracking added (see track() docs)
+Image area function added
+ImageSet's added
+Camera.live() function added
+External Scanner Support added (see Scanner class docs)
+Digital Camera Support added (i.e. point & shoot and SLR cameras)
+Stereo Camera Support added
+Logging Support added
+Feature Overlap (inside, outside, above, below, etc) comparison functions added
+Feature.show() added
+Feature aspect ratio added
+Feature distance functions added
+Feature bounding box added
+TONS and TONS of documentation added to everything!
+
+A special thanks in this release to anyone externally who has submitted
+code. A thanks to all those that made contributions for Google Summer of Code,
+or those that help on the support forums. A special thanks to the
+Google Summer of Code students of 2012 for all their help in making
+SimpleCV more awesome. Sorry this release took so long, as you can see
+we have added tons of features, a lot probably not even listed above. (-xamox)
+
+
+
+
Changes in 1.2
-------------------------------
scale - updated so it can be a value (eg Image.scale(0.5))
View
107 README.markdown
@@ -29,11 +29,41 @@ For more code snippets, we recommend the [SimpleCV examples website](http://exam
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.
### Ubuntu 12.04
- sudo apt-get install ipython python-opencv python-scipy python-numpy python-pygame python-setuptools python-pip
+ 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.
+### Virtualenv
+
+This is how to install SimpleCV under a python virtual environment [virtualenv] (http://www.virtualenv.org). 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
+
+
+
+
+
+
### Arch Linux
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
@@ -76,7 +106,7 @@ Commands (for Snow Leopard)::
mkdir ~/Code
cd ~/Code
- /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
+ 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
@@ -86,7 +116,7 @@ Commands (for Snow Leopard)::
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
- sudo pip install hg+http://bitbucket.org/pygame/pygame
+ 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
@@ -99,15 +129,38 @@ recommend using the Windows Superpack, available at <http://www.simplecv.org/dow
If you already have Python, OpenCV or SciPy installed and want to keep things the way you like them, follow the directions below
-Steps:
+#### 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
+
+
-* (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/
-* Install Python 2.7 http://www.python.org/getit/releases/2.7.1/
-* Install Python Setup Tools for Windows http://pypi.python.org/packages/2.7/s/setuptools/ (See: http://stackoverflow.com/questions/309412/how-to-setup-setuptools-for-python-2-6-on-windows)
-* 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 OpenCV: http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.2/ (See: http://luugiathuy.com/2011/02/setup-opencv-for-python/)
-* easy_install.exe simplecv (See: http://blog.sadphaeton.com/2009/01/20/python-development-windows-part-2-installing-easyinstallcould-be-easier.html)
+#### Install OpenCV:
+* 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::
+ C:\OpenCV2.3\
+
+
+* (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
@@ -126,19 +179,24 @@ If for some reason the shell doesn't start, you can always do so manually by run
python -c "import SimpleCV.Shell;SimpleCV.Shell.main()"
-To run SimpleCV within an ipython notebook:
+To run SimpleCV within an ipython notebook (ipython-notebooks are required to be installed):
- from SimpleCV import Display, Image
- display = Display(displaytype='notebook')
- image = Image('simplecv')
- image.save(display)
+ simplecv notebook
+
+
+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/demos/>
+<http://www.simplecv.org/learn/>
-------------------------------
## Getting Help
@@ -154,13 +212,13 @@ If for some reason the standard installation methods do not work you may have to
### Required Libraries
The installation instructions below should explain more on how to install. They can also be installed manually.
-* Python 2.6+
-* SciPy
-* NumPy
-* Pygame
-* OpenCV 2.3+
-* IPython 10+
-* PIL 1.1.7+
+* 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/>)
### Optional Libraries
@@ -178,8 +236,7 @@ These libraries are NOT required to run or use SimpleCV but are needed for some
* werkzeug
* webkit
* gtk
-* zxing (<http://code.google.com/p/zxing/>)
-* python-zxing (<https://github.com/oostendo/python-zxing>)
+* 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>)
View
9 SimpleCV/Camera.py
@@ -5,9 +5,6 @@
from SimpleCV.ImageClass import Image, ImageSet, ColorSpace
from SimpleCV.Display import Display
from SimpleCV.Color import Color
-from SimpleCV.Features import Line
-import platform
-from warnings import warn
#Globals
_cameras = []
@@ -188,7 +185,7 @@ def undistort(self, image_or_2darray):
"""
**SUMMARY**
- If given an image, apply the undistortion given my the camera's matrix and return the result.
+ If given an image, apply the undistortion given by the camera's matrix and return the result.
If given a 1xN 2D cvmat or a 2xN numpy array, it will un-distort points of
measurement and return them in the original coordinate system.
@@ -387,7 +384,7 @@ class Camera(FrameSource):
The Camera class is the class for managing input from a basic camera. Note
that once the camera is initialized, it will be locked from being used
- by other processes. You can check manually if you have compatable devices
+ by other processes. You can check manually if you have compatible devices
on linux by looking for /dev/video* devices.
This class wrappers OpenCV's cvCapture class and associated methods.
@@ -416,7 +413,7 @@ def __init__(self, camera_index = -1, prop_set = {}, threaded = True, calibratio
"""
**SUMMARY**
- In the camera onstructor, camera_index indicates which camera to connect to
+ In the camera constructor, camera_index indicates which camera to connect to
and props is a dictionary which can be used to set any camera attributes
Supported props are currently: height, width, brightness, contrast,
saturation, hue, gain, and exposure.
View
3  SimpleCV/Color.py
@@ -6,8 +6,7 @@
import random
from SimpleCV.base import *
from SimpleCV.ImageClass import *
-from pickle import *
-from math import cos, radians, ceil
+
class Color:
"""
View
2  SimpleCV/ColorModel.py
@@ -2,7 +2,7 @@
#load required libraries
from SimpleCV.base import *
from SimpleCV.ImageClass import *
-from pickle import *
+
class ColorModel:
"""
View
5 SimpleCV/DrawingLayer.py
@@ -4,10 +4,7 @@
import os
#from SimpleCV.base import *
from SimpleCV.Color import *
-#from SimpleCV import *
-from numpy import int32
-from numpy import uint8
-from pygame import gfxdraw
+
#DOCS
View
1  SimpleCV/Features/Blob.py
@@ -2,7 +2,6 @@
from SimpleCV.Features.Features import Feature, FeatureSet
from SimpleCV.Color import Color
from SimpleCV.ImageClass import Image
-from math import sin, cos, pi
class Blob(Feature):
"""
View
3  SimpleCV/Features/Detection.py
@@ -13,8 +13,7 @@
from SimpleCV.ImageClass import *
from SimpleCV.Color import *
from SimpleCV.Features.Features import Feature, FeatureSet
-from math import *
-from math import pi
+
######################################################################
View
2  SimpleCV/Features/Features.py
@@ -17,7 +17,7 @@
from SimpleCV.base import *
from SimpleCV.Color import *
import copy
-import types
+
class FeatureSet(list):
"""
View
2  SimpleCV/Features/Tracking.py
@@ -1,7 +1,7 @@
from SimpleCV.base import *
from SimpleCV.ImageClass import *
from SimpleCV.Features.Features import Feature, FeatureSet
-import time
+
class Tracking(Feature):
"""
View
266 SimpleCV/ImageClass.py
@@ -1,6 +1,7 @@
# Load required libraries
from SimpleCV.base import *
from SimpleCV.Color import *
+
from numpy import int32
from numpy import uint8
@@ -226,6 +227,58 @@ def download(self, tag=None, number=10, size='thumb'):
self.extend(add_set)
+ def upload(self,dest,api_key=None,api_secret=None, verbose = True):
+ """
+ **SUMMARY**
+ Uploads all the images to imgur or flickr or dropbox. In verbose mode URL values are printed.
+
+ **PARAMETERS**
+ * *api_key* - a string of the API key.
+ * *api_secret* (required only for flickr and dropbox ) - a string of the API secret.
+ * *verbose* - If verbose is true all values are printed to the
+ screen
+
+ **RETURNS**
+ if uploading is successful,
+ - Imgur return the original image URL on success and None if it fails.
+ - Flick returns True on success, else returns False.
+ - dropbox returns True on success.
+
+ **EXAMPLE**
+ TO upload image to imgur
+ >>> imgset = ImageSet("/home/user/Desktop")
+ >>> result = imgset.upload( 'imgur',"MY_API_KEY1234567890" )
+ >>> print "Uploaded To: " + result[0]
+
+ To upload image to flickr
+ >>> imgset.upload('flickr','api_key','api_secret')
+ >>> imgset.upload('flickr') #Once the api keys and secret keys are cached.
+
+ To upload image to dropbox
+ >>> imgset.upload('dropbox','api_key','api_secret')
+ >>> imgset.upload('dropbox') #Once the api keys and secret keys are cached.
+
+ **NOTES**
+ .. Warning::
+ This method requires two packages to be installed
+ -PyCurl
+ -flickr api.
+ -dropbox
+
+ .. Warning::
+ You must supply your own API key. See here:
+ - http://imgur.com/register/api_anon
+ - http://www.flickr.com/services/api/misc.api_keys.html
+ - https://www.dropbox.com/developers/start/setup#python
+ """
+ try :
+ for i in self:
+ i.upload(dest,api_key,api_secret, verbose)
+ return True
+
+ except :
+ return False
+
def show(self, showtime = 0.25):
"""
**SUMMARY**
@@ -463,71 +516,69 @@ def _read_gif(self, filename):
loaded += 1
return loaded
-
def load(self, directory = None, extension = None):
- """
- **SUMMARY**
-
- This function loads up files automatically from the directory you pass
- it. If you give it an extension it will only load that extension
- otherwise it will try to load all know file types in that directory.
-
- extension should be in the format:
- extension = 'png'
-
- **PARAMETERS**
-
- * *directory* - The path or directory from which to load images. If this
- * ends with .gif, it'll read from the gif file accordingly.
- * *extension* - The extension to use. If none is given png is the default.
-
- **RETURNS**
-
- The number of images in the image set.
-
- **EXAMPLE**
-
- >>> imgs = ImageSet()
- >>> imgs.load("images/faces")
- >>> imgs.load("images/eyes", "png")
-
- """
+ """
+ **SUMMARY**
+
+ This function loads up files automatically from the directory you pass
+ it. If you give it an extension it will only load that extension
+ otherwise it will try to load all know file types in that directory.
+
+ extension should be in the format:
+ extension = 'png'
+
+ **PARAMETERS**
+
+ * *directory* - The path or directory from which to load images.
+ * *extension* - The extension to use. If none is given png is the default.
- if not directory:
- print "You need to give a directory to load from"
- return
- elif directory.endswith(".gif"):
- return self._read_gif(directory)
+ **RETURNS**
+ The number of images in the image set.
- if not os.path.exists(directory):
- print "Invalid image path given"
- return
-
+ **EXAMPLE**
+
+ >>> imgs = ImageSet()
+ >>> imgs.load("images/faces")
+ >>> imgs.load("images/eyes", "png")
+
+ """
+ if not directory:
+ print "You need to give a directory to load from"
+ return
+
+ if not os.path.exists(directory):
+ print "Invalied image path given"
+ return
+
- if extension:
- extension = "*." + extension
- formats = [os.path.join(directory, extension)]
+ if extension:
+ extension = "*." + extension
+ formats = [os.path.join(directory, extension)]
- else:
- formats = [os.path.join(directory, x) for x in IMAGE_FORMATS]
+ else:
+ formats = [os.path.join(directory, x) for x in IMAGE_FORMATS]
- file_set = [glob.glob(p) for p in formats]
+ file_set = [glob.glob(p) for p in formats]
- self.filelist = dict()
+ self.filelist = dict()
+
+ for f in file_set:
+ for i in f:
+ tmp = None
+ try:
+ tmp = Image(i)
+ if( tmp is not None and tmp.width > 0 and tmp.height > 0):
+ if sys.platform.lower() == 'win32' or sys.platform.lower() == 'win64':
+ self.filelist[tmp.filename.split('\\')[-1]] = tmp
+ else:
+ self.filelist[tmp.filename.split('/')[-1]] = tmp
+ self.append(tmp)
+ except:
+ continue
+ return len(self)
- for f in file_set:
- for i in f:
- tmp = Image(i)
- if sys.platform.lower() == 'win32' or sys.platform.lower() == 'win64':
- self.filelist[tmp.filename.split('\\')[-1]] = tmp
- else:
- self.filelist[tmp.filename.split('/')[-1]] = tmp
- self.append(tmp)
-
- return len(self)
-
def standardize(self,width,height):
"""
**SUMMARY**
@@ -986,11 +1037,11 @@ def __del__(self):
"""
try :
for i in self._tempFiles:
- if (isinstance(i,str)):
- os.remove(i)
+ if (i[1]):
+ os.remove(i[0])
except :
pass
-
+
def getEXIFData(self):
"""
**SUMMARY**
@@ -2029,7 +2080,7 @@ def toString(self):
return self.toRGB().getBitmap().tostring()
- def save(self, filehandle_or_filename="", mode="", verbose=False, temp=False, path=None, fname=None, **params):
+ def save(self, filehandle_or_filename="", mode="", verbose=False, temp=False, path=None, filename=None, cleanTemp=False ,**params):
"""
**SUMMARY**
@@ -2056,8 +2107,10 @@ def save(self, filehandle_or_filename="", mode="", verbose=False, temp=False, pa
* *path* - path where temporary files needed to be stored
- * *fname* - name(Prefix) of the temporary file.
+ * *filename* - name(Prefix) of the temporary file.
+ * *cleanTemp* - This flag is made True if tempfiles are tobe deleted once the object is to be destroyed.
+
* *params* - This object is used for overloading the PIL save methods. In particular
this method is useful for setting the jpeg compression level. For JPG see this documentation:
http://www.pythonware.com/library/pil/handbook/format-jpeg.htm
@@ -2082,7 +2135,7 @@ def save(self, filehandle_or_filename="", mode="", verbose=False, temp=False, pa
.. Note::
You must have IPython notebooks installed for this to work
- path and fname are valid if and only if temp is set to True.
+ path and filename are valid if and only if temp is set to True.
.. attention::
We need examples for all save methods as they are unintuitve.
@@ -2090,37 +2143,36 @@ def save(self, filehandle_or_filename="", mode="", verbose=False, temp=False, pa
#TODO, we use the term mode here when we mean format
#TODO, if any params are passed, use PIL
- if temp and path!=None :
+ if temp :
import glob
- if fname==None :
- fname = 'Image'
+ if filename == None :
+ filename = 'Image'
+ if path == None :
+ path=tempfile.gettempdir()
if glob.os.path.exists(path):
path = glob.os.path.abspath(path)
- imagefiles = glob.glob(glob.os.path.join(path,fname+"*.png"))
+ imagefiles = glob.glob(glob.os.path.join(path,filename+"*.png"))
num = [0]
for img in imagefiles :
num.append(int(glob.re.findall('[0-9]+$',img[:-4])[-1]))
num.sort()
fnum = num[-1]+1
- fname = glob.os.path.join(path,fname+str(fnum)+".png")
- self._tempFiles.append(fname)
- self.save(self._tempFiles[-1])
- return self._tempFiles[-1]
+ filename = glob.os.path.join(path,filename+str(fnum)+".png")
+ self._tempFiles.append((filename,cleanTemp))
+ self.save(self._tempFiles[-1][0])
+ return self._tempFiles[-1][0]
else :
print "Path does not exist!"
-
- #if it's a temporary file
- elif temp :
- self._tempFiles.append(tempfile.NamedTemporaryFile(suffix=".png"))
- self.save(self._tempFiles[-1].name)
- return self._tempFiles[-1].name
-
+
+ else :
+ if (filename) :
+ filehandle_or_filename = filename + ".png"
+
if (not filehandle_or_filename):
if (self.filename):
filehandle_or_filename = self.filename
else:
filehandle_or_filename = self.filehandle
-
if (len(self._mLayers)):
saveimg = self.applyLayers()
@@ -2271,11 +2323,11 @@ def copy(self):
def upload(self,dest,api_key=None,api_secret=None, verbose = True):
"""
**SUMMARY**
- Uploads image to imgur or flickr. In verbose mode URL values are printed.
+ Uploads image to imgur or flickr or dropbox. In verbose mode URL values are printed.
**PARAMETERS**
* *api_key* - a string of the API key.
- * *api_secret* (required only for flickr) - a string of the API secret.
+ * *api_secret* (required only for flickr and dropbox ) - a string of the API secret.
* *verbose* - If verbose is true all values are printed to the
screen
@@ -2283,6 +2335,7 @@ def upload(self,dest,api_key=None,api_secret=None, verbose = True):
if uploading is successful,
- Imgur return the original image URL on success and None if it fails.
- Flick returns True on success, else returns False.
+ - dropbox returns True on success.
**EXAMPLE**
TO upload image to imgur
@@ -2294,16 +2347,22 @@ def upload(self,dest,api_key=None,api_secret=None, verbose = True):
>>> img.upload('flickr','api_key','api_secret')
>>> img.invert().upload('flickr') #Once the api keys and secret keys are cached.
+ To upload image to dropbox
+ >>> img.upload('dropbox','api_key','api_secret')
+ >>> img.invert().upload('dropbox') #Once the api keys and secret keys are cached.
+
**NOTES**
.. Warning::
This method requires two packages to be installed
-PyCurl
-flickr api.
+ -dropbox
.. Warning::
You must supply your own API key. See here:
- http://imgur.com/register/api_anon
- http://www.flickr.com/services/api/misc.api_keys.html
+ - https://www.dropbox.com/developers/start/setup#python
"""
if ( dest=='imgur' ) :
try:
@@ -2365,13 +2424,50 @@ def upload(self,dest,api_key=None,api_secret=None, verbose = True):
print "Uploading Failed !"
return False
else :
- import tempfile
- tf=tempfile.NamedTemporaryFile(suffix='.jpg')
- self.save(tf.name)
- temp = Image(tf.name)
- self.flickr.upload(tf.name,temp.filehandle)
+ tf = self.save(temp=True)
+ self.flickr.upload(tf,"Image")
return True
-
+
+ elif (dest=='dropbox'):
+ global dropbox_token
+ access_type = 'dropbox'
+ try :
+ from dropbox import client, rest, session
+ import webbrowser
+ except ImportError:
+ print "Dropbox API is not installed. For more info refer : https://www.dropbox.com/developers/start/setup#python "
+ return False
+ try :
+ if ( 'dropbox_token' not in globals() and api_key!=None and api_secret!=None ):
+ sess = session.DropboxSession(api_key, api_secret, access_type)
+ request_token = sess.obtain_request_token()
+ url = sess.build_authorize_url(request_token)
+ webbrowser.open(url)
+ print "Please visit this website and press the 'Allow' button, then hit 'Enter' here."
+ raw_input()
+ access_token = sess.obtain_access_token(request_token)
+ dropbox_token = client.DropboxClient(sess)
+ else :
+ if (dropbox_token) :
+ pass
+ else :
+ return None
+ except :
+ print "The API Key and Secret Key are not valid"
+ return False
+ if (self.filename) :
+ try :
+ f = open(self.filename)
+ dropbox_token.put_file('/SimpleCVImages/'+os.path.split(self.filename)[-1], f)
+ except :
+ print "Uploading Failed !"
+ return False
+ else :
+ tf = self.save(temp=True)
+ f = open(tf)
+ dropbox_token.put_file('/SimpleCVImages/'+'Image', f)
+ return True
+
def scale(self, width, height = -1):
"""
**SUMMARY**
View
37 SimpleCV/Shell/Shell.py
@@ -25,6 +25,7 @@
import subprocess
import time
import webbrowser
+import sys
#Load simpleCV libraries
from SimpleCV.Shell.Tutorial import *
@@ -190,21 +191,29 @@ def self_update():
def main(*args):
-
log_level = logging.WARNING
- if len(args) and len(args[0]) > 1:
- if "notebook" in args[0] and IPVER > 10:
- run_notebook()
- elif "update" in args[0]:
- self_update()
-
- for flag in args[0]:
- if flag in ["--headless","headless"]:
- init_options_handler.set_headless()
- elif flag in ['--nowarnings','nowarnings']:
- log_level = logging.INFO
- elif flag in ['--debug','debug']:
- log_level = logging.DEBUG
+ if len(sys.argv) > 1 and len(sys.argv[1]) > 1:
+ flag = sys.argv[1]
+ if flag == "notebook" and IPVER > 10:
+ run_notebook()
+ sys.exit()
+
+ elif flag == 'update':
+ print "Updating SimpleCV....."
+ self_update()
+
+
+ if flag in ["--headless","headless"]:
+ # set SDL to use the dummy NULL video driver,
+ # so it doesn't need a windowing system.
+ os.environ["SDL_VIDEODRIVER"] = "dummy"
+
+ elif flag in ['--nowarnings','nowarnings']:
+ log_level = logging.INFO
+
+ elif flag in ['--debug','debug']:
+ log_level = logging.DEBUG
+
init_logging(log_level)
shellclear()
View
2  SimpleCV/__init__.py
@@ -1,4 +1,4 @@
-__version__ = '1.2.0'
+__version__ = '1.3.0'
from SimpleCV.base import *
from SimpleCV.Camera import *
View
32 SimpleCV/base.py
@@ -18,14 +18,36 @@
import abc #abstract base class
import colorsys
import logging
+import pygame as pg
+import scipy.ndimage as ndimage
+import scipy.stats.stats as sss #for auto white balance
+import scipy.cluster.vq as scv
+import scipy.linalg as nla # for linear algebra / least squares
+import math # math... who does that
+import copy # for deep copy
+import numpy as np
+import scipy.spatial.distance as spsd
+import scipy.cluster.vq as cluster #for kmeans
+import pygame as pg
+import platform
+import copy
+import types
+import time
+from numpy import linspace
+from scipy.interpolate import UnivariateSpline
+from warnings import warn
from copy import copy
-from math import sqrt, atan2
+from math import *
from pkg_resources import load_entry_point
from SimpleHTTPServer import SimpleHTTPRequestHandler
from types import IntType, LongType, FloatType, InstanceType
from cStringIO import StringIO
-
+from numpy import int32
+from numpy import uint8
+from EXIF import *
+from pygame import gfxdraw
+from pickle import *
# SimpleCV library includes
try:
@@ -36,12 +58,6 @@
except ImportError:
raise ImportError("Cannot load OpenCV library which is required by SimpleCV")
-import numpy as np
-import scipy.spatial.distance as spsd
-import scipy.cluster.vq as cluster #for kmeans
-from numpy import linspace
-from scipy.interpolate import UnivariateSpline
-
#optional libraries
PIL_ENABLED = True
View
BIN  SimpleCV/sampleimages/FSTest.png
Deleted file not rendered
View
BIN  SimpleCV/sampleimages/FSTest2.png
Deleted file not rendered
View
BIN  SimpleCV/sampleimages/FSTest3.png
Deleted file not rendered
View
BIN  SimpleCV/sampleimages/FSTest4.png
Deleted file not rendered
View
BIN  SimpleCV/sampleimages/FSTest5.png
Deleted file not rendered
View
BIN  SimpleCV/sampleimages/greenscreen.jpg
Deleted file not rendered
View
BIN  SimpleCV/sampleimages/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
22 SimpleCV/tests/BOFTester.py
@@ -1,22 +0,0 @@
-from SimpleCV import *
-from numpy import *
-from SimpleCV.Features import BOFFeatureExtractor
-import os
-import glob
-import time
-cat_path = "./data/cat/truth/"
-cheeseburger_path = "./data/cheeseburger/truth/"
-paths = [cat_path,cheeseburger_path]
-bof = BOFFeatureExtractor()
-#bof.load('cbdata.txt')
-bof.generate(paths,imgs_per_dir=200,numcodes=256,sz=(11,11),img_layout=(16,16),padding=4 )
-bof.save("codebook.png","cbdata.txt")
-#count = 0
-#test = bof.reconstruct(Image("codebook.png"))
-#test.save("anticodebook.jpg")
-#for infile in glob.glob( os.path.join(cat_path, '*.jpg') ):
-# print "opening file: " + infile
-# img = Image(infile)
-# oimg = bof.reconstruct(img)
-# fname = infile[0:-4]+"_reconstruction.png"
-# oimg.save(fname)
View
98 SimpleCV/tests/DisplayTester.py
@@ -1,98 +0,0 @@
-import time
-from SimpleCV import *
-from SimpleCV.Display import Display, pg
-w = 400
-h = 300
-t=1
-display = Display(resolution = (w,h)) #create a new display to draw images on
-img = Image('../sampleimages/aerospace.jpg')
-img = img.scale(800,600)
-img2 = img.scale(w,h)
-smallWbigH = img.scale(100,400)
-smallHbigW = img2.scale(500,100)
-smallW = img2.scale(100,h)
-smallH = img2.scale(w,100)
-small = img2.scale(99,23)
-big = img2.scale(555,432)
-
-foo = "Image:"+str((img.width,img.height))
-print(foo)
-print('Image should scale clean')
-display.writeFrame(img)
-time.sleep(t)
-
-foo = "Image:"+str((img2.width,img2.height))
-print(foo)
-print('Image should scale clean')
-display.writeFrame(img2)
-time.sleep(t)
-
-foo = "Image:"+str((smallWbigH.width,smallWbigH.height))
-print(foo)
-display.writeFrame(smallWbigH)
-time.sleep(t)
-
-foo = "Image:"+str((smallHbigW.width,smallHbigW.height))
-print(foo)
-display.writeFrame(smallHbigW)
-time.sleep(t)
-
-foo = "Image:"+str((smallW.width,smallW.height))
-print(foo)
-display.writeFrame(smallW)
-time.sleep(t)
-
-foo = "Image:"+str((smallH.width,smallH.height))
-print(foo)
-display.writeFrame(smallH)
-time.sleep(t)
-
-foo = "Image:"+str((small.width,small.height))
-print(foo)
-display.writeFrame(small)
-time.sleep(t)
-
-foo = "Image:"+str((big.width,big.height))
-print(foo)
-display.writeFrame(big)
-time.sleep(t)
-
-foo = "Crop Image:"+str((img.width,img.height))
-print(foo)
-display.writeFrame(img, fit=False)
-time.sleep(t)
-
-foo = "Crop Image:"+str((img2.width,img2.height))
-print(foo)
-display.writeFrame(img2, fit=False)
-time.sleep(t)
-
-foo = "Crop Image:"+str((smallWbigH.width,smallWbigH.height))
-print(foo)
-display.writeFrame(smallWbigH, fit=False)
-time.sleep(t)
-
-foo = "Crop Image:"+str((smallHbigW.width,smallHbigW.height))
-print(foo)
-display.writeFrame(smallHbigW, fit=False)
-time.sleep(t)
-
-foo = "Crop Image:"+str((smallW.width,smallW.height))
-print(foo)
-display.writeFrame(smallW, fit=False)
-time.sleep(t)
-
-foo = "Crop Image:"+str((smallH.width,smallH.height))
-print(foo)
-display.writeFrame(smallH, fit=False)
-time.sleep(t)
-
-foo = "Crop Image:"+str((small.width,small.height))
-print(foo)
-display.writeFrame(small, fit=False)
-time.sleep(t)
-
-foo = "Crop Image:"+str((big.width,big.height))
-print(foo)
-display.writeFrame(big, fit=False)
-time.sleep(t)
View
292 SimpleCV/tests/MLTestSuite.py
@@ -1,292 +0,0 @@
-from SimpleCV import *
-
-print ""
-print "This program runs a list of test for machine learning on"
-print "the SimpleCV library. Not all scores will be high, this"
-print "is just to ensure that the libraries are functioning correctly"
-print "on your system"
-print ""
-print "***** WARNING *****"
-print "This program is about to download a large data set to run it's test"
-
-
-inp = raw_input("Do you want to continue [Y/n]")
-if not (inp == "" or inp.lower() == "y"):
- print "Exiting the program"
- sys.exit()
-
-
-machine_learning_data_set = "https://github.com/downloads/ingenuitas/SimpleCV/machine_learning_dataset.zip"
-data_path = download_and_extract(machine_learning_data_set)
-print data_path
-w = 800
-h = 600
-n=50
-
-display = Display(resolution = (w,h))
-
-hue = HueHistogramFeatureExtractor(mNBins=16)
-edge = EdgeHistogramFeatureExtractor()
-bof = BOFFeatureExtractor()
-bof.load('../Features/cbdata.txt')
-haar = HaarLikeFeatureExtractor(fname="../Features/haar.txt")
-morph = MorphologyFeatureExtractor()
-
-spath = data_path + "/data/structured/"
-upath = data_path + "/data/unstructured/"
-ball_path = spath+"ball/"
-basket_path = spath+"basket/"
-boat_path = spath+"boat/"
-cactus_path = spath +"cactus/"
-cup_path = spath+"cup/"
-duck_path = spath+"duck/"
-gb_path = spath+"greenblock/"
-match_path = spath+"matches/"
-rb_path = spath+"redblock/"
-s1_path = spath+"stuffed/"
-s2_path = spath+"stuffed2/"
-s3_path = spath+"stuffed3/"
-
-arbor_path = upath+"arborgreens/"
-football_path = upath+"football/"
-sanjuan_path = upath+"sanjuans/"
-
-
-
-print('SVMPoly')
-#Set up am SVM with a poly kernel
-extractors = [hue]
-path = [cactus_path,cup_path,basket_path]
-classes = ['cactus','cup','basket']
-props ={
- 'KernelType':'RBF', #default is a RBF Kernel
- 'SVMType':'C', #default is C
- 'nu':None, # NU for SVM NU
- 'c':None, #C for SVM C - the slack variable
- 'degree':3, #degree for poly kernels - defaults to 3
- 'coef':None, #coef for Poly/Sigmoid defaults to 0
- 'gamma':None, #kernel param for poly/rbf/sigma - default is 1/#samples
- }
-print('Train')
-classifierSVMP = SVMClassifier(extractors,props)
-classifierSVMP.train(path,classes,disp=display,subset=n) #train
-print('Test')
-[pos,neg,confuse] = classifierSVMP.test(path,classes,disp=display,subset=n)
-files = []
-for ext in IMAGE_FORMATS:
- files.extend(glob.glob( os.path.join(path[0], ext)))
-for i in range(10):
- img = Image(files[i])
- cname = classifierSVMP.classify(img)
- print(files[i]+' -> '+cname)
-classifierSVMP.save('PolySVM.pkl')
-print('Reloading from file')
-testSVM = SVMClassifier.load('PolySVM.pkl')
-#testSVM.setFeatureExtractors(extractors)
-files = glob.glob( os.path.join(path[0], '*.jpg'))
-for i in range(10):
- img = Image(files[i])
- cname = testSVM.classify(img)
- print(files[i]+' -> '+cname)
-
-print('###############################################################################')
-print('SVMRBF ')
-# now try an RBF kernel
-extractors = [hue,edge]
-path = [cactus_path,cup_path,basket_path]
-classes = ['cactus','cup','basket']
-props ={
- 'KernelType':'RBF', #default is a RBF Kernel
- 'SVMType':'NU', #default is C
- 'nu':None, # NU for SVM NU
- 'c':None, #C for SVM C - the slack variable
- 'degree':None, #degree for poly kernels - defaults to 3
- 'coef':None, #coef for Poly/Sigmoid defaults to 0
- 'gamma':None, #kernel param for poly/rbf/sigma
- }
-print('Train')
-classifierSVMRBF = SVMClassifier(extractors,props)
-classifierSVMRBF.train(path,classes,disp=display,subset=n) #train
-print('Test')
-[pos,neg,confuse] = classifierSVMRBF.test(path,classes,disp=display,subset=n)
-files = glob.glob( os.path.join(path[0], '*.jpg'))
-for i in range(10):
- img = Image(files[i])
- cname = classifierSVMRBF.classify(img)
- print(files[i]+' -> '+cname)
-classifierSVMRBF.save('RBFSVM.pkl')
-print('Reloading from file')
-testSVMRBF = SVMClassifier.load('RBFSVM.pkl')
-#testSVMRBF.setFeatureExtractors(extractors)
-files = glob.glob( os.path.join(path[0], '*.jpg'))
-for i in range(10):
- img = Image(files[i])
- cname = testSVMRBF.classify(img)
- print(files[i]+' -> '+cname)
-
-
-print('###############################################################################')
-print('Bayes')
-extractors = [haar]
-classifierBayes = NaiveBayesClassifier(extractors)#
-print('Train')
-path = [arbor_path,football_path,sanjuan_path]
-classes = ['arbor','football','sanjuan']
-classifierBayes.train(path,classes,disp=display,subset=n) #train
-print('Test')
-[pos,neg,confuse] = classifierBayes.test(path,classes,disp=display,subset=n)
-files = glob.glob( os.path.join(path[0], '*.jpg'))
-for i in range(10):
- img = Image(files[i])
- cname = classifierBayes.classify(img)
- print(files[i]+' -> '+cname)
-classifierBayes.save('Bayes.pkl')
-print('Reloading from file')
-testBayes = NaiveBayesClassifier.load('Bayes.pkl')
-testBayes.setFeatureExtractors(extractors)
-files = glob.glob( os.path.join(path[0], '*.jpg'))
-for i in range(10):
- img = Image(files[i])
- cname = testBayes.classify(img)
- print(files[i]+' -> '+cname)
-
-print('###############################################################################')
-
-
-print('###############################################################################')
-print('Forest')
-extractors = [morph]
-classifierForest = TreeClassifier(extractors,flavor='Forest')#
-print('Train')
-path = [s1_path,s2_path,s3_path]
-classes = ['s1','s2','s3']
-classifierForest.train(path,classes,disp=display,subset=n) #train
-print('Test')
-[pos,neg,confuse] = classifierForest.test(path,classes,disp=display,subset=n)
-files = glob.glob( os.path.join(path[0], '*.jpg'))
-for i in range(10):
- img = Image(files[i])
- cname = classifierForest.classify(img)
- print(files[i]+' -> '+cname)
-
-classifierForest.save('forest.pkl')
-print('Reloading from file')
-testForest = TreeClassifier.load('forest.pkl')
-testForest.setFeatureExtractors(extractors)
-files = glob.glob( os.path.join(path[0], '*.jpg'))
-for i in range(10):
- img = Image(files[i])
- cname = testForest.classify(img)
- print(files[i]+' -> '+cname)
-
-print('###############################################################################')
-print('Bagged Tree')
-extractors = [haar]
-classifierBagTree = TreeClassifier(extractors,flavor='Bagged')#
-print('Train')
-path = [s1_path,s2_path,s3_path]
-classes = ['s1','s2','s3']
-classifierBagTree.train(path,classes,disp=display,subset=n) #train
-print('Test')
-[pos,neg,confuse] = classifierBagTree.test(path,classes,disp=display,subset=n)
-files = glob.glob( os.path.join(path[0], '*.jpg'))
-for i in range(10):
- img = Image(files[i])
- cname = classifierBagTree.classify(img)
- print(files[i]+' -> '+cname)
-
-classifierBagTree.save('bagtree.pkl')
-print('Reloading from file')
-testBagTree = TreeClassifier.load('bagtree.pkl')
-testBagTree.setFeatureExtractors(extractors)
-files = glob.glob( os.path.join(path[0], '*.jpg'))
-for i in range(10):
- img = Image(files[i])
- cname = testBagTree.classify(img)
- print(files[i]+' -> '+cname)
-
-
-
-print('###############################################################################')
-print('Vanilla Tree')
-extractors = [haar]
-classifierTree = TreeClassifier(featureExtractors=extractors)
-print('Train')
-path = [s1_path,s2_path,s3_path]
-classes = ['s1','s2','s3']
-classifierTree.train(path,classes,disp=display,subset=n) #train
-print('Test')
-[pos,neg,confuse] = classifierTree.test(path,classes,disp=display,subset=n)
-files = glob.glob( os.path.join(path[0], '*.jpg'))
-for i in range(10):
- img = Image(files[i])
- cname = classifierTree.classify(img)
- print(files[i]+' -> '+cname)
-print('Reloading from file')
-classifierTree.save('tree.pkl')
-testTree = TreeClassifier.load('tree.pkl')
-testTree.setFeatureExtractors(extractors)
-for i in range(10):
- img = Image(files[i])
- cname = testTree.classify(img)
- print(files[i]+' -> '+cname)
-
-print('###############################################################################')
-print('Boosted Tree')
-extractors = [haar]
-classifierBTree = TreeClassifier(extractors,flavor='Boosted')#
-print('Train')
-path = [s1_path,s2_path,s3_path]
-classes = ['s1','s2','s3']
-classifierBTree.train(path,classes,disp=display,subset=n) #train
-print('Test')
-[pos,neg,confuse] = classifierBTree.test(path,classes,disp=display,subset=n)
-files = glob.glob( os.path.join(path[0], '*.jpg'))
-for i in range(10):
- img = Image(files[i])
- cname = classifierBTree.classify(img)
- print(files[i]+' -> '+cname)
-
-classifierBTree.save('btree.pkl')
-print('Reloading from file')
-
-testBoostTree = TreeClassifier.load('btree.pkl')
-testBoostTree.setFeatureExtractors(extractors)
-files = glob.glob( os.path.join(path[0], '*.jpg'))
-for i in range(10):
- img = Image(files[i])
- cname = testBoostTree.classify(img)
- print(files[i]+' -> '+cname)
-
-
-
-
-print('###############################################################################')
-print('KNN')
-extractors = [hue,edge]
-classifierKNN = KNNClassifier(extractors)#
-print('Train')
-path = [s1_path,s2_path,s3_path]
-classes = ['s1','s2','s3']
-classifierKNN.train(path,classes,disp=display,subset=n) #train
-print('Test')
-[pos,neg,confuse] = classifierKNN.test(path,classes,disp=display,subset=n)
-files = glob.glob( os.path.join(path[0], '*.jpg'))
-for i in range(10):
- img = Image(files[i])
- cname = classifierKNN.classify(img)
- print(files[i]+' -> '+cname)
-
-classifierKNN.save('knn.pkl')
-print('Reloading from file')
-testKNN = KNNClassifier.load('knn.pkl')
-testKNN.setFeatureExtractors(extractors)
-files = glob.glob( os.path.join(path[0], '*.jpg'))
-for i in range(10):
- img = Image(files[i])
- cname = testKNN.classify(img)
- print(files[i]+' -> '+cname)
-
-
-print ""
-print "All the machine learning test have ran correctly"
View
3  SimpleCV/tests/README
@@ -19,6 +19,3 @@ if everything is fine and dandy. But you will get errors if something
is broken.
------------------------------------------------------------------------
-
-TODO:
-Need to add pychecker to test.
View
45 SimpleCV/tests/TestFlann.py
@@ -1,45 +0,0 @@
-from SimpleCV import *
-w = 800
-h = 600
-data_path = "./../sampleimages/"
-display = Display(resolution = (w,h))
-spath = data_path + "/data/structured/"
-ball_path = spath+"ball/"
-basket_path = spath+"basket/"
-boat_path = spath+"boat/"
-cactus_path = spath +"cactus/"
-cup_path = spath+"cup/"
-duck_path = spath+"duck/"
-gb_path = spath+"greenblock/"
-match_path = spath+"matches/"
-rb_path = spath+"redblock/"
-s1_path = spath+"stuffed/"
-s2_path = spath+"stuffed2/"
-s3_path = spath+"stuffed3/"
-logo_path = spath+"logo/"
-
-# [0.3360040567951319, 0.37035158891142661, 0.24431626098715353, 0.10554006085192696, 0.23206135902636918, 0.14729124408384045]
-
-tpath = spath+"KeypointTemplate.jpg"
-template = Image(tpath)
-template.save(display)
-time.sleep(1)
-paths = [logo_path,boat_path,basket_path,cactus_path,cup_path,duck_path]
-results = []
-for p in paths:
- print "Doing Data Set: " + p
- local = []
- files = glob.glob( os.path.join(p, '*.jpg'))
- for f in files:
- img = Image(f)
- r = img.keypointMatch(template)
- print r
- local.append(r)
- img.drawText(str(r),10,10,color=Color.RED)
- img.save(display)
-
- overall = np.average(local)
- print "Overall Result"
- print overall
- results.append(overall)
-print results
View
8 SimpleCV/tests/cbdata.txt
@@ -1,8 +0,0 @@
-BOF Codebook Data
-128
-11
-11
-0
-8
-16
-codebook.png
View
BIN  SimpleCV/tests/standard/test_hough_circle1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  SimpleCV/tests/standard/test_hough_circle2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  SimpleCV/tests/standard/test_image_new_crop0.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  SimpleCV/tests/standard/test_image_new_crop1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  SimpleCV/tests/standard/test_image_new_crop2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  SimpleCV/tests/standard/test_image_new_crop3.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2  SimpleCV/tests/testSystem.py
@@ -1,2 +0,0 @@
-from SimpleCV import *
-system()
View
44 SimpleCV/tests/tests.py
@@ -13,7 +13,7 @@
from SimpleCV import *
from nose.tools import with_setup, nottest
-VISUAL_TEST = True # if TRUE we save the images - otherwise we DIFF against them - the default is False
+VISUAL_TEST = False # if TRUE we save the images - otherwise we DIFF against them - the default is False
SHOW_WARNING_TESTS = False # show that warnings are working - tests will pass but warnings are generated.
#colors
@@ -1678,7 +1678,7 @@ def test_findKeypoints():
kp.draw()
results = [img]
name_stem = "test_findKeypoints"
- perform_diff(results,name_stem)
+ #~ perform_diff(results,name_stem)
pass
@@ -1727,7 +1727,7 @@ def test_movement_feature():
results = [current1,current2,current3]
name_stem = "test_movement_feature"
- perform_diff(results,name_stem,tolerance=4.0)
+ #~ perform_diff(results,name_stem,tolerance=4.0)
pass
@@ -2005,7 +2005,6 @@ def test_detection_spatial_relationships():
motion = motion.crop(0,0,img.width,img.height)
blobFS = img.findBlobs()
lineFS = img.findLines()
- circFS = img.findCircle(10)
cornFS = img.findCorners()
moveFS = img.findMotion(motion)
moveFS = FeatureSet(moveFS[42:52]) # l337 s5p33d h4ck - okay not really
@@ -2016,7 +2015,7 @@ def test_detection_spatial_relationships():
aPoly = [(0,0),(img.width/2,0),(0,img.height/2)] # a triangle
- feats = [blobFS,lineFS,circFS,cornFS,tempFS,moveFS]
+ feats = [blobFS,lineFS,cornFS,tempFS,moveFS]
for f in feats:
print str(len(f))
@@ -2434,7 +2433,7 @@ def test_on_edge():
results = [imgA,imgB,imgC,imgD,imgE]
name_stem = "test_onEdge_Features"
- perform_diff(results,name_stem,tolerance=8.0)
+ #~ perform_diff(results,name_stem,tolerance=8.0)
def test_feature_angles():
img = Image("../sampleimages/rotation2.png")
@@ -2773,7 +2772,7 @@ def test_findKeypoints_all():
kp.draw()
results = [img]
name_stem = "test_findKeypoints"
- perform_diff(results,name_stem,tolerance=8)
+ #~ perform_diff(results,name_stem,tolerance=8)
pass
@@ -2782,17 +2781,17 @@ def test_upload_flickr():
import flickrapi
except:
if( SHOW_WARNING_TESTS ):
- logger.warning("Couldn't run the upload test as optional pycurl library required")
+ logger.warning("Couldn't run the upload test as optional flickr library required")
pass
else:
img = Image('simplecv')
- api_key = 'ccfa805e5c7693b96fb548fa0f7a36da'
- api_secret = 'db1479dbba974633'
+ api_key = ''
+ api_secret = ''
if api_key==None or api_secret==None :
pass
else :
ret=img.upload('flickr',api_key,api_secret)
- if ret == True :
+ if ret :
pass
else :
assert False
@@ -2836,6 +2835,7 @@ def test_image_temp_save():
if i==None :
assert False
assert True
+<<<<<<< HEAD
def test_image_set_average():
iset = ImageSet()
@@ -2900,3 +2900,25 @@ def sliceinImageSet():
else :
assert False
+=======
+
+def test_upload_dropbox():
+ try:
+ import dropbox
+ except:
+ if( SHOW_WARNING_TESTS ):
+ logger.warning("Couldn't run the upload test as optional dropbox library required")
+ pass
+ else:
+ img = Image('simplecv')
+ api_key = ''
+ api_secret = ''
+ if api_key==None or api_secret==None :
+ pass
+ else :
+ ret=img.upload('dropbox',api_key,api_secret)
+ if ret :
+ pass
+ else :
+ assert False
+>>>>>>> af29e047ff88003132f0ffb6225a60a5eb4f8808
1  SimpleCV/utils/cloud9
@@ -1 +0,0 @@
-Subproject commit 5272cded4b70bba5e89e75f05474c652a57f1985
View
3  doc/HOWTO-RELEASE.txt
@@ -1,10 +1,11 @@
make sure tests run clean
do a git clone (or clean)
-update changelog
+update changelog (use a program like meld to look at differences, copy folder, checkout previous version, then diff the two files and go through the files)
change version in setup.py
change version in doc/conf.py
change version in init.py
update via commit and be sure to tag release commit in git repo
+rebuild docs and push to website
push to repo
python setup.py sdist --format=zip
python setup.py sdist --format=gztar
View
58 doc/conf.py
@@ -14,58 +14,6 @@
import sys,os
-#added for Readthedocs support, this is used to trick out imports
-#that depend on the C libraries.
-class Mock(object):
- def __init__(self, *args, **kwargs):
- pass
-
- def __call__(self, *args, **kwargs):
- return Mock()
-
- @classmethod
- def __getattr__(self, name):
- if name in ('__file__', '__path__'):
- return '/dev/null'
- elif name[0] == name[0].upper():
- return type(name, (), {})
- else:
- return Mock()
-
-on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
-if on_rtd:
- MOCK_MODULES = [
- 'cv2',
- 'cv',
- 'cv2.cv',
- 'numpy',
- 'pygame',
- 'scipy',
- 'scipy.spatial',
- 'scipy.spatial.distance',
- 'scipy.ndimage',
- 'scipy.stats.stats',
- 'distance',
- 'scipy.cluster',
- 'scipy.cluster.vq',
- 'cluster.vq',
- 'vq',
- 'scipy.interpolate',
- 'interpolate',
- 'Image',
- 'zxing',
- 'freenect',
- 'tesseract',
- 'orange',
- 'orngTest',
- 'orngStat',
- 'orngEnsemble',
- 'stats.stats',
- ]
-
- for mod_name in MOCK_MODULES:
- sys.modules[mod_name] = Mock()
-
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -95,16 +43,16 @@ def __getattr__(self, name):
# General information about the project.
project = u'SimpleCV'
-copyright = u'2011, Ingeuitas'
+copyright = u'2011, Sight Machine'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
-version = '1.2'
+version = '1.3'
# The full version, including alpha/beta/rc tags.
-release = '1.2'
+release = '1.3'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
View
11 requirements.txt
@@ -1,8 +1,5 @@
-SimpleCV
-
-pygame>=1.9.1
-PIL==1.1.7
-nose>=1.0.0
-ipython>=0.12
-numpy>=numpy-2.0.0
+https://github.com/numpy/numpy/zipball/master
+https://github.com/scipy/scipy/zipball/master
+PIL
+ipython
View
154 scripts/install/ubuntu/simplecv-install.sh
@@ -10,30 +10,130 @@
# please visit the mailing list at:
# http://www.simplecv.org
#
-echo "Install SimpleCV"
-echo "Installing pre-reqisites"
-sleep 1
-#echo "Installing OpenCV..."
-#sudo apt-get install libopencv-*
-#sudo apt-get install python-opencv
-#echo "OpenCV installed"
-echo "Installing numpy and scipy"
-sudo apt-get install python-numpy python-scipy
-echo "numpy and scipy installed"
-echo "Installing pygame"
-sudo apt-get install python-pygame
-echo "pygame installed"
-echo "Installing python-setuptools"
-sudo apt-get install python-setuptools
-echo "setuptools installed"
-echo "Installing ipython and ipython notebook"
-sudo apt-get install ipython ipython-notebook
-echo "ipython installed"
-ehco "Downloading SimpleCV"
-git clone https://github.com/ingenuitas/SimpleCV.git
-echo "Installing SimpleCV"
-cd SimpleCV/
-sudo python setup.py install
-echo "SimpleCV Installation finished"
-echo "For more info go to http://simplecv.org/"
-echo "$ simplecv"
+
+simplecv_auto_install() {
+ echo "Installing SimpleCV"
+ sleep 1
+ install_opencv
+ install_numpy_scipy
+ install_pygame
+ install_setuptools
+ install_ipython
+ install_simplecv
+ echo "For more info go to http://simplecv.org/"
+ echo "to run simplecv just type:"
+ echo "$ simplecv"
+}
+
+install_opencv(){
+ echo "Installing OpenCV..."
+ sudo apt-get install --yes libopencv-*
+ sudo apt-get install --yes python-opencv
+ echo "OpenCV installed"
+}
+
+install_numpy_scipy() {
+ echo "Installing numpy and scipy"
+ sudo apt-get install --yes python-numpy python-scipy
+ echo "numpy and scipy installed"
+}
+
+install_pygame() {
+ echo "Installing pygame"
+ sudo apt-get install --yes python-pygame
+ echo "pygame installed"
+}
+
+install_setuptools(){
+ echo "Installing python-setuptools"
+ sudo apt-get install --yes python-setuptools python-pip
+ echo "setuptools installed"
+}
+
+install_ipython() {
+ echo "Installing ipython and ipython notebook"
+ sudo apt-get install --yes ipython ipython-notebook
+ echo "ipython installed"
+}
+
+
+install_simplecv(){
+ echo "Installing SimpleCV"
+ sudo pip install -U https://github.com/ingenuitas/SimpleCV/zipball/master
+ echo "SimpleCV Installation finished"
+}
+
+simplecv_manual_install () {
+ reset
+ echo "[Manual-Installing SimpleCV]"
+ read -p "Install OpenCV? (y/N) " -n 1 -r
+ if [[ $REPLY =~ ^[Yy]$ ]]
+ then
+ install_opencv
+ fi
+ read -p "Install Numpy/Scipy? (y/N) " -n 1 -r
+ if [[ $REPLY =~ ^[Yy]$ ]]
+ then
+ install_numpy_scipy
+ fi
+ read -p "Install Pygame? (y/N) " -n 1 -r
+ if [[ $REPLY =~ ^[Yy]$ ]]
+ then
+ install_pygame
+ fi
+ read -p "Install Setuptools/PIP? (y/N) " -n 1 -r
+ if [[ $REPLY =~ ^[Yy]$ ]]
+ then
+ install_setuptools
+ fi
+ read -p "Install IPython? (y/N) " -n 1 -r
+ if [[ $REPLY =~ ^[Yy]$ ]]
+ then
+ install_ipython
+ fi
+ read -p "Install SimpleCV? (y/N) " -n 1 -r
+ if [[ $REPLY =~ ^[Yy]$ ]]
+ then
+ install_simplecv
+ fi
+
+ echo "For more info go to http://simplecv.org/"
+ echo "to run simplecv just type:"
+ echo "$ simplecv"
+
+}
+
+# The main script launch point
+reset
+while :
+do
+ case "$1" in
+ -i | --install)
+ echo "install command line"
+ simplecv_auto_install
+ return
+ ;;
+ -m | --manual)
+ echo "install simplecv manually"
+ simplecv_manual_install
+ return
+ ;;
+ esac
+ break
+done
+
+
+echo "--------------------------------------------------------------------"
+echo "SimpleCV setup tool"
+echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
+echo ""
+echo "Auto-Installing SimpleCV in 5 seconds"
+echo "press ctrl+c to cancel"
+echo ""
+echo "to manually install run"
+echo "simplecv-install.sh --manual"
+echo ""
+echo "..."
+sleep 5
+simplecv_auto_install
+
View
4 scripts/install/ubuntu/stdeb.cfg
@@ -7,5 +7,5 @@
# sudo python setup.py --command-packages=stdeb.command bdist_deb
[DEFAULT]
-Depends: python, python-numpy, python-scipy, ipython, python-opencv, python-pygame
-Suggests: python-nose
+Depends: python, python-numpy, python-scipy, ipython, python-opencv, python-pygame, python-setuptools
+Suggests: python-nose, python-pip, ipython-notebook
View
66 scripts/install/win/Building_The_Installer.rst
@@ -1,32 +1,60 @@
How to build installer for windows
===============================================
-You need to download and install NSIS:
-http://nsis.sourceforge.net/
+The best method is to use a fresh copy of Windows in a virtual machine.
-Then put the:
-EnvVarUpdate.nsh
+Once you have a virtual machine setup with a clean copy of windows, make
+a snapshot of it because it will be useful for testing the installer
+actually works.
-In the NSIS install folder. This is needed to set the system paths.
+VirtualBox was used for testing:
+https://www.virtualbox.org
+
+
+Setup the script files and required libraries.
+-----------------------------------------------
+Download all the required files listed in the README for SimpleCV on
+windows and store all these files in a folder called 'files' on
+the desktop of the Virtual Machine.
+
+Also download the install.bat file and copy into this folder as well.
+
+So for SimpleCV 1.3 we have:
+Desktop/files/python-2.7.3.msi
+Desktop/files/setuptools-0.6c11.win32-py2.7.exe
+Desktop/files/scipy-0.9.0rc5-win32-superpack-python2.7.exe
+Desktop/files/numpy-1.6.2-win32-superpack-python2.7.exe
+Desktop/files/pygame-1.9.1.win32-py2.7.msi
+Desktop/files/OpenCV-2.3.1-win-superpack.exe
+Desktop/files/install.bat
-You then need to use NSIS to create a OpenKinect.exe from a Zip (If open
-kinect has been updated)
Modify the install.bat file to include all the files you need to run post
-installation.
+installation. Make sure to update the system paths to match as well, for
+instance we are using C:\SimpleCV1.3\files, make sure these all match up.
+As well as the version of SimpleCV being installed by PIP.
+
+
+Build the Installer
+-----------------------------------------------
+Download and Install the Advanced Installer for Windows:
+http://www.advancedinstaller.com
+
+
+* Create a Simple Project
+* Fill out the project details tab
+* Set to major upgrade when/if prompted instead of patch
+* On the Install Parameters tab set the application folder to the correct version, in our case: c:\SimpleCV1.3
+* On the files & folders tab, select the 'application folder', then add a folder from the top menu, and add our 'files' directory from the desktop
+* On the dialog tab select 'ExitDialog', under the launch application section check the box 'launch application at the end of installation',
+navigate to the desktop/files folder, you may have to select 'show all files' to see the install.bat file.
+* Check the box, 'checked by default' and 'Run finish actions without displaying this dialog'.
+* Now build the installer, it will prompt where to save the project, the desktop should be fine.
-Make sure you checkout the correct version of SimpleCV you want from git.
-Then copy the SimpleCV folder to your desktop. In that folder you can
-remove the build, dist, as well as the hidden folder .git.
+The installer should now be on the desktop in the folder 'SimpleCV1.3-SetupFiles'.
-Then run NSIS and follow the wizard to build the setup file to create the
-exe. Once the setup file is generated update accordingly.
+It is recommended that you snapshot the virtualmachine at this point to verify the installer works.
+You will also have to copy the built setup installer from the VM before rolling back to the fresh install snapshot.
-For instance you have to tell it to run install.bat when it is done, but
-you may not be able to select it from the list in the wizard as it only
-shows .exe files. In our case we just picked the opencv.exe file
-So after the install setup file is generated, you can
-open it and manually set the section that says to launch the startup file
-which was the opencv.exe we picked and change that to install.bat
Note: Please test the installer on a clean Virtual Machine before deploying.
View
44 scripts/install/win/install.bat
@@ -1,23 +1,35 @@
@echo off
-SETX PATH C:/Python27/;C:/Python27/Scripts/;C:/OpenCV2.2/bin/;%PATH%
-SETX PYTHONPATH C:/OpenCV2.2/Python2.7/Lib/site-packages;%PYTHONPATH%
-SET PATH=C:/Python27/;C:/Python27/Scripts/;C:/OpenCV2.2/bin/;%PATH%
-SET PYTHONPATH=C:/OpenCV2.2/Python2.7/Lib/site-packages;%PYTHONPATH%
-cd "C:\Program Files\SimpleCV\install_files\"
-python-2.7.2.msi
+echo "Setting System paths"
+SETX PATH C:/SimpleCV1.3/files/opencv/build/x86/vc10/bin/;C:/Python27/;C:/Python27/Scripts/;C:/OpenCV2.3/opencv/build/x86/vc10/bin/;%PATH%
+SETX PYTHONPATH C:/SimpleCV1.3/files/opencv/build/python/2.7/;C:/OpenCV2.3/opencv/build/python/2.7/;%PYTHONPATH%
+SET PATH=C:/SimpleCV1.3/files/opencv/build/x86/vc10/bin/;C:/Python27/;C:/Python27/Scripts/;C:/OpenCV2.3/opencv/build/x86/vc10/bin/;%PATH%
+SET PYTHONPATH=C:/SimpleCV1.3/files/opencv/build/python/2.7/;C:/OpenCV2.3/opencv/build/python/2.7/;%PYTHONPATH%
+
+echo "Running System Requirement Installers"
+echo "Please click next on each of the additional installers"
+echo "unless you don't need that specific library installed,"
+echo "then click cancel on that specific installer"
+
+cd "C:\SimpleCV1.3\files"
+echo "Installing Python 2.7"
+python-2.7.3.msi
+echo "Installing Python Setuptools"
setuptools-0.6c11.win32-py2.7.exe
-scipy-0.10.0rc1-win32-superpack-python2.7.exe
-numpy-1.6.1-win32-superpack-python2.7.exe
-ipython-0.10.2.win32-setup.exe
-pygame-1.9.2a0.win32-py2.7.msi
-OpenCV-2.2.0-win32-vs2010.exe
+echo "Installing Scipy"
+scipy-0.9.0rc5-win32-superpack-python2.7.exe
+echo "Installing Numpy"
+numpy-1.6.2-win32-superpack-python2.7.exe
+echo "Install Pygame"
+pygame-1.9.1.win32-py2.7.msi
+echo "Installing OpenCV"
+OpenCV-2.3.1-win-superpack.exe
easy_install pyreadline
easy_install PIL
easy_install cython
-easy_install nose
easy_install pip
-pip install simplecv
+pip install ipython
+pip install https://github.com/ingenuitas/SimpleCV/zipball/1.3
echo "The Download path is:"
%1
mkdir C:\Python27\Lib\site-packages\freenect
@@ -25,4 +37,8 @@ echo "Copying freenect setup files"
xcopy %1\OpenKinect\precompiled\*.py C:\Python27\Lib\site-packages\freenect /y
xcopy %1\OpenKinect\precompiled\*.dll C:\Python27\DLLs /y
xcopy %1\OpenKinect\precompiled\*.pyd C:\Python27\DLLs /y
-mklink c:%HOMEPATH%\Desktop\simplecv.py C:\Python27\Lib\site-packages\SimpleCV\__init__.py
+echo ""
+echo "SimpleCV 1.3 is now installed"
+echo ""
+echo "This window will autoclose...."
+timeout /T 10
View
47 scripts/mkvirt.py
@@ -0,0 +1,47 @@
+import os
+import virtualenv, textwrap
+
+here = os.path.dirname(os.path.abspath(__file__))
+base_dir = os.path.dirname(here)
+
+print "Creating SimpleCV Bootstrap Install Script: simplecv-bootstrap.py"
+
+output = virtualenv.create_bootstrap_script(textwrap.dedent("""
+import os, subprocess
+
+def after_install(options, home_dir):
+ base_dir = os.path.dirname(home_dir)
+ logger.notify('Installing SimpleCV into Virtual Environment')
+
+ os.chdir(home_dir)
+ print 'Current Directory:', os.getcwd()
+ print 'dir list:', os.listdir(os.getcwd())
+ print 'Symlinking OpenCV'
+ os.symlink('/usr/local/lib/python2.7/dist-packages/cv2.so', os.path.join(os.getcwd(),'lib/python2.7/site-packages/cv2.so'))
+ os.symlink('/usr/local/lib/python2.7/dist-packages/cv.py', os.path.join(os.getcwd(),'lib/python2.7/site-packages/cv.py'))
+ subprocess.call(['pwd'])
+ os.mkdir('src')
+ os.chdir('src')
+ subprocess.call(['wget','-O','pygame.tar.gz','http://github.com/xamox/pygame/tarball/master'])
+ subprocess.call(['tar','zxvf','pygame.tar.gz'])
+ print 'Runing setup for pygame'
+ subprocess.call(['ls'])
+ os.chdir('../')
+ print 'Current Directory:', os.getcwd()
+ print os.getcwd()
+ subprocess.call(['./bin/python','src/xamox-pygame-3e48d10/setup.py','install'])
+
+
+"""))
+f = open('simplecv-bootstrap.py', 'w').write(output)
+
+
+#~ sudo apt-get install python-opencv python-setuptools python-pip gfortran g++ liblapack-dev libsdl1.2-dev libsmpeg-dev mercurial
+
+#~ source bin/activate
+#~ cd src/pygame
+#~ python setup.py -setuptools install
+#~ pip install https://github.com/ingenuitas/SimpleCV/zipball/masteriii
+# call_subprocess(['python','setup.py','-setuptools','install'], show_stdout=True)
+#call_subprocess([join(home_dir, 'bin', 'pip'),'install','-r','requirements.txt'], show_stdout=True)
+
View
53 scripts/virtualenv-bootstrap.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+reset
+echo "This Script Creates a python virtual environment for SimpleCV"
+echo ""
+echo ""
+read -p "Continue [Y/n]? " -n 1
+if [[ $REPLY =~ ^[Nn]$ ]]
+then
+ echo ""
+ exit 1
+fi
+
+read -p "Install System Level Dependencies [y/N]? " -n 1
+if [[ $REPLY =~ ^[Yy]$ ]]
+then
+ echo ""
+ echo "Installing System Dependencies....."
+ sudo apt-get install python-opencv python-setuptools python-pip gfortran g++ liblapack-dev libsdl1.2-dev libsmpeg-dev
+fi
+
+
+echo "Creating Virtual Environment"
+virtualenv --distribute venv
+echo "Entering Virtual Environment"
+cd venv
+echo "Symbolic Linking OpenCV"
+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
+echo "Installing dependencies"
+./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
+echo "Downloading pygame"
+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 ..
+echo "Running setup for pygame"
+./bin/python src/pygame-pygame-6625feb3fc7f/setup.py -setuptools install
+./bin/pip install https://github.com/ingenuitas/SimpleCV/zipball/master
+
+reset
+echo "SimpleCV should now be installed in the virtual environment"
+echo "to run just type:"
+echo ""
+echo "cd venv"
+echo "source bin/activate"
+echo "simplecv"
+echo ""
+
View
16 setup.py
@@ -1,13 +1,11 @@
from setuptools import setup, find_packages
import os, sys, glob, fnmatch
-#from SimpleCV import __version__
-
setup(name="SimpleCV",
- version=1.2,
- download_url='http://sourceforge.net/projects/simplecv/files/1.2/SimpleCV-1.2.tar.gz',
+ version=1.3,
+ download_url='https://github.com/ingenuitas/SimpleCV/zipball/1.3',
description="Make Computers See with SimpleCV, the Python Framework for Machine Vision",
- long_description="""Super-library for machine vision wrappers in Python, providing a unified, pythonic interface to image aquisition, conversion, manipulation, and feature extraction.""",
+ long_description="""Framework for computer (machine) vision in Python, providing a unified, pythonic interface to image aquisition, conversion, manipulation, and feature extraction.""",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
@@ -22,7 +20,7 @@
'Topic :: Software Development :: Libraries :: Python Modules'],
keywords='opencv, cv, machine vision, computer vision, image recognition, kinect, freenect',
author='Sight Machine Inc',
- author_email='support@ingenuitas.com',
+ author_email='support@sightmachine.com',
url='http://simplecv.org',
license='BSD',
packages = find_packages(exclude=['ez_setup']),
@@ -40,6 +38,10 @@
'examples/tracking/*'
],
},
- scripts=['scripts/simplecv']
+ entry_points={
+ 'console_scripts': [
+ 'simplecv = SimpleCV.Shell:main',
+ ],
+ },
)
View
38 simplecv.rb
@@ -1,38 +0,0 @@
-require 'formula'
-
-class Simplecv < Formula
- head 'git://github.com/ingenuitas/SimpleCV.git'
- homepage 'http://www.simplecv.org/'
- #url 'https://github.com/downloads/ingenuitas/SimpleCV/simplecv.tar.gz'
- md5 'ab524249721152955f68bf54c2744400'
-
- depends_on 'libtiff' => :build
- depends_on 'sdl' => :build
- depends_on 'sdl_image' => :build
- depends_on 'sdl_mixer' => :build
- depends_on 'sdl_ttf' => :build
- #depends_on 'smpeg' => :build
- depends_on 'portmidi' => :build
- depends_on 'hg' => :build
- depends_on 'opencv' => :build