Giter Club home page Giter Club logo

simplecv's Introduction


SimpleCV


Build Status

Quick Links:

About


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()

For more code snippets, we recommend the SimpleCV examples website or looking at our example scripts in SimpleCV/examples


Installation

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.

Docker

This is the recommended way of installing SimpleCV as you can be sure the environment will be setup the same exact way as it's suppose to be on your machine.

WARNING: Using docker does not allow the webcam to work, it also doesn't work with Image.show(), so essentially requires you to use simplecv within an IPython notebook.

The first step is to install docker on your machine if you have not, this should work for Windows, Mac, and Linux, please follow instructions at: https://docs.docker.com/installation/

Once docker is installed you can run simplecv as easy as (may have to run as sudo, depending on OS):

docker pull sightmachine/simplecv

It will probably take a little while to download, but once done just run (may need to run as sudo, depending on OS):

docker run -p 54717:8888 -t -i sightmachine/simplecv

Then just open your web browser and go to:

http://localhost:54717

NOTE: If you are using a Mac or Windows it will be a little different since you will be boot2docker to run. When you run boot2docker up it should show the ip address of the docker service. It could be something like 192.168.59.103, but this will change as it's random. Once you know that ip you will just go to that IP address with the correct port instead:

http://192.168.59.103:54717

You will get a Ipython notebook inteface, start a new notebook and enter the following:

from SimpleCV import *
disp = Display(displaytype='notebook')
img = Image('simplecv')
img.save(disp)

You should now see the simplecv logo and now have a full simplecv environment setup to start playing around.

Ubuntu 12.04

Install with pip

sudo apt-get install ipython python-opencv python-scipy python-numpy python-pygame python-setuptools python-pip
sudo pip install https://github.com/sightmachine/SimpleCV/zipball/develop

Install using clone of SimpleCV repository

sudo apt-get install ipython python-opencv python-scipy python-numpy python-pygame python-setuptools git
git clone https://github.com/sightmachine/SimpleCV.git
cd SimpleCV/
sudo pip install -r requirements.txt
sudo python setup.py install

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 -r requirements.txt
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/sightmachine/SimpleCV/zipball/develop

Arch Linux

Install using pip

pacman -S python2-numpy opencv2.4.4_1 python-pygame python2-setuptools ipython2 python2-pip
pip install https://github.com/sightmachine/SimpleCV/zipball/develop

Install using clone of SimpleCV repository

pacman -S python2-numpy opencv2.4.4_1 python-pygame python2-setuptools ipython2
git clone https://github.com/sightmachine/SimpleCV.git
cd SimpleCV/
sudo python setup.py install

Install development version using aur

yaourt -S simplecv-git

Fedora

Fedora 20 and above

sudo yum -y install python-SimpleCV

Fedora 18

Install with pip

sudo yum -y install python-ipython opencv-python scipy numpy pygame python-setuptools python-pip
sudo python-pip install https://github.com/sightmachine/SimpleCV/zipball/develop

Install using clone of SimpleCV repository

sudo yum -y install python-ipython opencv-python scipy numpy pygame python-setuptools python-pip git
git clone https://github.com/sightmachine/SimpleCV.git
cd SimpleCV/
sudo python setup.py install
### 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.


Explicit (as in every step) instructions compliments of JHawkins

These instructions are geared towards people who are just getting started with python development on OSX. They will walk you through setting up all the tools you need to build SimpleCV from scratch. If you don't know which instructions you want, you probably want to use these.

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:

brew doctor

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:

brew update

followed by

brew upgrade

Install OpenCV via homebrew by running:

brew tap homebrew/science
brew install opencv

Be sure to add the requested line to you ~/.bash_profile:

export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"

Source your ~/.bash_profile file so that the changes take effect:

source ~/.bash_profile

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. Download PIL:

curl -O -L http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz

In the unpacked folder:

python setup.py build --force
sudo python setup.py install

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

Install svgwrite by running:

sudo pip install svgwrite

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/sightmachine/SimpleCV.git
cd SimpleCV/
sudo python setup.py install

JHawkins' Instructions Install SimpleCV via PIP by running:

sudo pip install https://github.com/sightmachine/SimpleCV/zipball/master

Test by running simplecv in the command line:

simplecv

If it starts (it should!) be sure to check out:

 example()

Lion Take Two

This is the abridged set of the instructions. It assumes you have most of the common OSX developer tools installed like brew and pip. If you don't know what Brew or Pip are you probably want to use the instructions above. For OSX 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.

Before you begin installing SimpleCV make sure you have the folliwng tools installed.

Commands (for Lion)::

mkdir ~/Code
cd ~/Code
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
brew tap homebrew/science
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/sightmachine/SimpleCV/zipball/master

Commands (for Snow Leopard)::

mkdir ~/Code
cd ~/Code
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
brew tap homebrew/science
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/sightmachine/SimpleCV/zipball/master

Windows 7/Vista

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 OpenCV:

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/sightmachine/SimpleCV/zipball/1.3

###Windows 8 Step 1

http://www.simplecv.org/download => Go to this page and download SimpleCV latest stable version Superpack . It will start downloading a file named SimpleCV-(version).msi . This file will be around 192mb .

Step 2

After Downloading run the file . It will start an installation window along with a command prompt window. Give yes permission and press next . First it will install python 2.7.3 . Then it will install numpy,scipy,Pygame,openCV and now all the normal installation windows will be closed and still there will be command prompt running . Leave it as such it will download some other file like cython and when it is finished commandpromt will display a success message "SimpleCV installed successfully" "press any button in 10sec or will close automatically " . Now just press any button or wait for the count down .

Step 3

This is the final step and here we are confirming our SimpleCV installation. To do this open Python IDLE . Type in any of these two commands :

  >>from SimpleCV import *
         or
  >>import SimpleCV

If this two commands works fine without any errors our installation was successfull. If some error occurs we should uninstall and restart or check some forums.

NOTE:- If this error is shown: "AttributeError: 'module' object has no attribute 'csgraph_to_masked' " . Before this they will be showing list of paths of scipy library . The solution for this is to install latest stable version of scipy for windows . www.scipy.org/Download => we can download latest stable version of scipy for windows here.

RASPBERRY PI


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:

simplecv

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):

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/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/sightmachine/simplecv-mobile-camera


Getting Help

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.

Required Libraries

The installation instructions below should explain more on how to install. They can also be installed manually.

Optional Libraries

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.

simplecv's People

Contributors

amstan avatar ankit-maverick avatar codetab avatar cvmat avatar fabaff avatar gaboose avatar iandanforth avatar jayrambhia avatar jessehawkins avatar khannan1 avatar kscottz avatar mechiris avatar mfkaptan avatar nathanhruby avatar oostendo avatar pap-x avatar pclove1 avatar polart avatar rajatkapoor avatar rishimukherjee avatar rsiera avatar salilkapur avatar stbnps avatar stephenbalaban avatar tendrid avatar victorssilva avatar vighneshbirodkar avatar vijaym123 avatar westonnh avatar xamox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simplecv's Issues

findLines crop functionality does not work correctly

img = Image('logo')
l = img.findLines()
c = l.crop() #returns an np.array type of None

The desired functionality is to crop to the line feature. Also returning np.array of images for crop seems wrong. Seems like a list / image set would be the better approach.

findBarcode produces error on Windows 7

The following code produces an error when finding a barcode. The barcode.png is from the sampleimages directory.

from SimpleCV import *
from zxing import *
i = Image("./barcode.png")
b = i.findBarcode("./zxing")
print b.data

The error produced is:

from SimpleCV import *
from zxing import *
i = Image("./barcode.png")
b = i.findBarcode("./zxing")
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/zxing/clie
nt/j2se/CommandLineRunner
Caused by: java.lang.ClassNotFoundException: com.google.zxing.client.j2se.Comman
dLineRunner
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: com.google.zxing.client.j2se.CommandLineRunner.
Program will exit.
print b.data

Add caching for haar file's

The haarfile is being loaded each time in the loop when doing detection, we need a way to cache it after it has been loaded once.

createAlphaMask() not working correctly.

This function works although the output doesn't appear to be what would be expected. Where as you would expect it to function similar to an alpha mask in photo shop where (black or white) get's passed through.

download link on homepage

Hi,
being on OSX is just clicked on the download link.
Afterwards, I noticed:

  1. it gets SimpleCV 1.1 even though 1.2. is out (but no superpack for that)
  2. It wants to run a install script that puts all kinds of files all over the system .....
    (using sudo, making symlinks and stuff)
  3. did not work with my distutils config file.

Why don't you give people a choice - inserting one more page after clicking on download,
explaining the options .....

  • Sebastian Haase

Mac install failure

I installed SimpleCV using the .PKG superpack for Mac, but Python can't find the SimpleCV module.

$ python
Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from SimpleCV import Camera
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named SimpleCV

Specs

$ system_profiler SPSoftwareDataType | grep Mac
      System Version: Mac OS X 10.7.3 (11D50b)
$ python --version
Python 2.7.1

Current solution involves easy_install SimpleCV

When calling methods from documentation, error is given

I'm following this example:

http://simplecv.org/doc/cookbook.html#using-a-camera-kinect-or-virtualcamera
Where is reads:
(red, green, blue) = Camera().getImage().channels()
I do it like this, as I already defined cam = Camera()
cam.getImage().channels()

but I get this error:

SimpleCV:21>(red, green, blue) = cam.getImage().channels()

AttributeError Traceback (most recent call last)

/usr/local/lib/python2.7/dist-packages/SimpleCV/Shell/Shell.pyc in ()
----> 1
2
3
4
5

AttributeError: Image instance has no attribute 'channels'

closing python(v2.7) image window

I'm trying SimpleCV 1.2 on Ubuntu 11.04
we know that we can load an image to SImpleCV by using the function Image(path)
eg: myImage= Image("/home/ubuntu/pics/face.jpeg")

then the image will appear in the python(v2.7) window if the image exists after using the function myImage.show()

In the picture window, the exit button is not working. I couldn't find any other method to close this window.

16-bit images as a native SimpleCV.Image() representation

For both the Microsoft Kinect, and other range or time-of-flight cameras, depth data comes in as 16-bit signed integers, standing in as fixed-point values for distances away from the device. The dynamic range and z-resolution is important to maintain, and crushing to 8-bit makes the data essentially unusable. Having 16-bit images supported transparently in SimpleCV would go a long, long way in this regard.

Face detection is slow

I've tried to write a quick face detection script using SimpleCV. Although I love how simple it is, it seems to be really slow compared to the OpenCV Python version. Is there some API I'm using in the wrong way?

import sys
from SimpleCV import Camera, Color
from SimpleCV.Display import Display

def main():
    # Try to connect to the camera.
    cam  = Camera()

    if not cam:
        print 'Error opening camera. Exiting...'
        sys.exit(1)

    # Create PyGame display.
    disp = Display()

    # Main processing loop.
    while not disp.isDone():
        # Get an image from the camera.
        img = cam.getImage()

        faces = img.findHaarFeatures("haarcascade_frontalface_alt.xml")
        i = 0
        if not faces is None:
            for f in faces:
                f.draw(Color.GREEN)

        # Show the camera image.
        img.save(disp)

if __name__ == "__main__":
    try:
        main()
    except KeyboardInterrupt:
        print "\nStopping..."
        sys.exit(1)

Save/Display need to convert to RGB

After re-writing the test suite I noticed that a lot of the color conversions aren't handled correctly in the display and save methods. I think save/display should automagically do the conversion to RGB prior to saving or display the images.

calling Camera() results in errors

I'm using Ubuntu 11.10

SimpleCV:1>cam = Camera()
mmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
Unable to stop the stream.: Bad file descriptor
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
SimpleCV:2>cam = Camera()
libv4l2: error setting pixformat: Device or resource busy
HIGHGUI ERROR: libv4l unable to ioctl S_FMT

libv4l2: error setting pixformat: Device or resource busy
libv4l1: error setting pixformat: Device or resource busy
HIGHGUI ERROR: libv4l unable to ioctl VIDIOCSPICT


SystemError Traceback (most recent call last)

/usr/local/lib/python2.7/dist-packages/SimpleCV/Shell/Shell.pyc in ()
----> 1
2
3
4
5

/usr/local/lib/python2.7/dist-packages/SimpleCV/Camera.pyc in init(self, camera_index, prop_set, threaded, calibrationfile)
292 self.capture = pygame.camera.Camera("/dev/video" + str(camera_index))
293
--> 294 self.capture.start()
295 time.sleep(0)
296 self.pygame_buffer = self.capture.get_image()

SystemError: ioctl(VIDIOC_S_FMT) failure: no supported formats
SimpleCV:3>

AttributeError: Image instance has no attribute 'convert'

I cannot get function sprite() to work.

from SimpleCV import *

cam = Camera()
j=0
fillimg = Image("img.jpg")
while (j<100):
i = cam.getImage()
i.dl().sprite(fillimg, pos=(0,0), scale=0.1)
j=j+1
i.show()

Traceback (most recent call last):
File "asdf.py", line 8, in
i.dl().sprite(fillimg, pos=(0,0), scale=0.1)
File "/usr/lib/pymodules/python2.7/SimpleCV/DrawingLayer.py", line 516, in sprite
image = image.convert(self._mSurface)
AttributeError: Image instance has no attribute 'convert'

Add update functionality to SimpleCV.

Need to just setup a script so simplecv can update itself without having to use git (or just use git via python).

I would like something basically you fire up the simplecv shell and type:
update()

Camera not defined

Let me start by saying Im not just new to programming, but also new to the mac OS. I watched the video you made for installing SimpleCV. I installed to all the default directories.
When I tried the camera command, or any I get device not defined. So it says camera not defined for the camera command.
What am i missing?
Jason

Creating a camera shows warnings

I'm using SimpleCV 1.2 with Ubuntu 12.04. Creating a camera without an argument results in a number of warnings:

>>> from SimpleCV import *
>>> cam = Camera()
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
>>> 

I would have expected this to be handled transparently (just give me the first camera you can find), unless I specify an argument (e.g. 0 or 1 for first or second camera). The same warnings show when I pass 0 as an argument, however.

On a side note, if you pass OpenCV's cv.CaptureFromCAM the argument -1, it should grab whatever camera it can get. I think SimpleCV instead passes OpenCV index 0 by default.

Index assignment of a feature set returns a list, not a feature set.

Came across this while writing a test case. When you take a sublist of a featureset using index notation it returns a list of features when it should return a featureset. This makes it impossible to use featureset member functions on sub-lists.

Example:

SimpleCV:18> img = Image("lenna")
SimpleCV:19> l = img.findLines()
SimpleCV:20> l2 = l[0:10]
SimpleCV:21> type(l2)
SimpleCV:21: list
SimpleCV:22> l2.above((img.width/2,img.height/2)
....: )
ERROR

Can't set font for blitting unicode text

I'd like to blit Japanese text onto an image, but it shows up as a bunch of rectangles.

I try setting the font to Arial, a unicode font, but that results in an IOError.

Code:

SimpleCV.Font().setFont("/Users/andrew/Desktop/src/sensei/arial.ttf")

Trace:

<type 'int'>
Traceback (most recent call last):
  File "./sensei.py", line 51, in <module>
    main()
  File "./sensei.py", line 19, in main
    SimpleCV.Font().setFont("/Users/andrew/Desktop/src/sensei/arial.ttf")
  File "build/bdist.macosx-10.7-intel/egg/SimpleCV/Font.py", line 49, in __init__
  File "build/bdist.macosx-10.7-intel/egg/SimpleCV/Font.py", line 78, in setFont
  File "/usr/local/lib/python2.7/site-packages/PIL/ImageFont.py", line 218, in truetype
    return FreeTypeFont(filename, size, index, encoding)
  File "/usr/local/lib/python2.7/site-packages/PIL/ImageFont.py", line 134, in __init__
    self.font = core.getfont(file, size, index, encoding)
IOError: cannot open resource

Windows 7 install issues

I've installed "simplecv-setup-1.2.exe" on Windows 7 Professional SP1 and I'm getting a few errors.
First, iPython fails with the error *** run_installscript: internal error 0xFFFFFFFF ***

then Cython fails with: "Unable to find vcvarsall.bat"
Here's the full easy_install process:

Running Cython-0.16\setup.py -q bdist_egg --dist-dir c:\temp\easy_install-kmaamv
\Cython-0.16\egg-dist-tmp-siyvpj
Compiling module Cython.Plex.Scanners ...
Compiling module Cython.Plex.Actions ...
Compiling module Cython.Compiler.Lexicon ...
Compiling module Cython.Compiler.Scanning ...
Compiling module Cython.Compiler.Parsing ...
Compiling module Cython.Compiler.Visitor ...
Compiling module Cython.Compiler.FlowControl ...
Compiling module Cython.Compiler.Code ...
Compiling module Cython.Runtime.refnanny ...
warning: no files found matching '*.pyx' under directory 'Cython\Debugger\Tests'

warning: no files found matching '*.pxd' under directory 'Cython\Debugger\Tests'

warning: no files found matching '.h' under directory 'Cython\Debugger\Tests'
warning: no files found matching '
.pxd' under directory 'Cython\Utility'
warning: no files found matching '*.h' under directory 'Cython\Utility'
warning: no files found matching '.cpp' under directory 'Cython\Utility'
warning: no files found matching 'bugs.txt' under directory 'tests'
error: Setup script exited with error: Unable to find vcvarsall.bat

Looks like Cython requires " Microsoft’s Visual C" to be installed or the open source MinGW (a Windows distribution of gcc).

Any suggestions as how to proceed if I don't have either?

Dependency omissions: SciPy/NumPy and PyGame

Instead of shouting in the docs that users must MUST MUST install SciPy/NumPy, consider making SciPy/NumPy a dependency in the egg. The whole point of SimpleCV is making opencv easy; this sort of thing should be automated.

The docs seem to indicate that either SciPy or NumPy is sufficient. Whichever is better suited for use with SimpleCV should have a dependency entry in the egg.

Ditto for PyGame.

ImportError when importing the Shell

I'm running Ubuntu 12.04, with SimpleCV version 1.2.

I can't seem to import the shell. I can show the simplecv logo from a normal Python shell, but this is quite annoying as it's impossible to close windows in this version.

>>> from SimpleCV import Shell
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.7/SimpleCV/Shell/__init__.py", line 1, in     <module>
    from Shell import *
  File "/usr/lib/pymodules/python2.7/SimpleCV/Shell/Shell.py", line 35, in <module>
    from IPython.Shell import IPShellEmbed
ImportError: No module named Shell

Need to get Travis-CI working.

I have tried, but can't seem to get travis-cI (http://travis-ci.org/) working. This is due to the fact I can't seem to get it to install opencv on their servers even using apt-get and trying with opencv 2.1. The travis.yml file is already in the simplecv repo. I believe they have all the python required libs for simplecv to run, but feel free to add a pip requriements file if needed.

Loading Haar Cascades

We currently need to load Haar Cascade files like:

face = cv.Load("face.xml")

It would probably be better not to make users work with the underlying opencv objects. Something like:

face = HaarCascade("face.xml")

would probably be more consistent with the way the rest of SimpleCV works.

sampleimages folder not being added in dist-packages

I downloaded SimpleCV from GitHub just now. I installed it

sudo python setup.py install

I tried

i = Image("simplecv")

I am getting error

IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/SimpleCV-1.2-py2.7.egg/SimpleCV/sampleimages/simplecv.png'

sampleimages folder is not there in /usr/local/lib/python2.7/dist-packages/SimpleCV-1.2-py2.7.egg/SimpleCV
So, I looked at setup.py file, I couldn't find any problems.

package_data  = { #DO NOT REMOVE, NEEDED TO LOAD INLINE FILES i = Image('simplecv')
        'SimpleCV': ['sampleimages/*'],
        'SimpleCV':['Features/HaarCascades/*'],

HaarCascades are there but not sampleimages.

I tried re-installing SimpleCV from source that I had downloaded couple of weeks back. It's setup file includes only sampleimages.

package_data  = { #DO NOT REMOVE, NEEDED TO LOAD INLINE IMAGES
        'SimpleCV': ['sampleimages/*']

After installing from old version, I can access sampleimages

i = Image("simplecv")

Installed SimpleCV-e7665f5 > http://bpaste.net/show/28462/
Installed SimpleCV-3fea5c1 > http://bpaste.net/show/mcMUp9gjCWoWTvB5EBzX/

UserWarning: SimpleCV Find Blobs Failed

What does the below error message means?

And how can i solve that? I am running example MotionTracker.py

UserWarning: SimpleCV Find Blobs Failed - This could be an OpenCV python binding issue warnings.warn("SimpleCV Find Blobs Failed - This could be an OpenCV python binding issue")

Camera() issue

ubuntu 10.10 fresh clean install / opencv 2.1 (python-opencv) / python-scipy / python-imaging / python-numpy /python-pygame / 1-click install of SimpleCV all installed.

trying to run:
from SimpleCV import *
mycam = Camera()
img = mycam.getImage()

getting:
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
File "/usr/local/lib/python2.6/dist-packages/SimpleCV-1.2-py2.6.egg/SimpleCV/Camera.py", line 23, in run
<type 'exceptions.TypeError'>: 'NoneType' object is not iterable

also tried:
sudo easy_install simplecv
install_dir /usr/local/lib/python2.6/dist-packages/
Searching for simplecv
Best match: SimpleCV 1.2
Processing SimpleCV-1.2-py2.6.egg
SimpleCV 1.2 is already the active version in easy-install.pth

Using /usr/local/lib/python2.6/dist-packages/SimpleCV-1.2-py2.6.egg
Processing dependencies for simplecv
Finished processing dependencies for simplecv

help. thanks

Color Model fails with Color Tuples

Another finding from the improved unit tests -- color model doesn't like to take in tuples. Seems to work well with images. The following will return an all white image. The correct behavior is to color the red, green, and blue, sections black and have everything else be white.

SimpleCV:50> img = Image("logo")

SimpleCV:51> cm = ColorModel()

SimpleCV:52> cm.add((255,0,0))

SimpleCV:53> cm.add((0,255,0))

SimpleCV:54> cm.add((0,0,255))

SimpleCV:55> cm.theshold(img)

SimpleCV:56> test = cm.threshold(img)

SimpleCV:57> test.show()
SimpleCV:57: <SimpleCV.Display Object resolution:((250, 250)), Image Resolution: (250, 250) at memory location: (0x118a97128)>

SimpleCV:58> cm.add((0,0,0))

SimpleCV:59> test = cm.threshold(img)

SimpleCV:60> test = cm.threshold(img)

SimpleCV:61> cm.add((255,255,255))

SimpleCV:62> cm
SimpleCV:62: <SimpleCV.ColorModel.ColorModel instance at 0x118a92878>

SimpleCV:63> cm.mData
SimpleCV:63:
{'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00': 1,
'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x00\x00\x00\x00\x00': 1,
'\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00': 1,
'\x7f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00': 1,
'\x7f\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x00\x00\x00\x00\x00': 1}

featureset.show() should use a disposable drawing layer

when building tests, i use featureset.show() a lot, and it is annoying when tuning parameters to have to run img.clearLayers() every time I want to change a number. featureset.show() should initialize a drawing layer, apply to image, and then discard it.

no typecheck in npArray2cvMat

SimpleCV.npArray2cvMat apparently silently assumes that it get single precision float (np.float32)

In other case strange errors occur:

U.arrD((1,0,0),(0,1,0.))
array([[ 1., 0., 0.],
[ 0., 1., 0.]])
SimpleCV.npArray2cvMat( U.arrD((1,0,0),(0,1,0.)) )
<cvmat(type=42424005 32FC1 rows=2 cols=3 step=24 )>
N.asarray(_)
array([[ 0. , 1.875, 0. ],
[ 0. , 0. , 0. ]], dtype=float32)

A couple unit test are failing on Ubuntu 11.04 (12 out of 81 fail)

When running:
nosetest SimpleCV/test/tests.py

Get a few errors on the blobs, and a couple other test. It appears to be with the OpenCV constants.
Currently on my Ubuntu 10.10 machine which everything is running fine, going to dump unit test output when I return home.

Image.findBlobs()

This function seems to die very often by hitting the max recursion depth (even on simple test cases).

Is there a better set of default arguments to prevent hitting this failure?

Need system information function.

We need a way to do something like:
import SimpleCV
SimpleCV.system()

And have it output all the various system and library information. So the person can copy and paste when they submit bug reports so we don't have to elicit that information everytime someone submits a bug. (i.e. Did you install on windows? What version? What version of SimpleCV are you running? What pygame version? etc).

Allow the user to view and change Jpeg Quality Settings

A friend wants to use SimpleCV to perform some tasks common performed by image magick. He uses image magick to go through a pile of images, check the jpeg quality setting, and if it is too high re-save the image at a lower quality setting. If the jpeg is already at a lower quality then nothing needs to be done. I noticed that this is possible via PIL but not exposed cleanly through the SimpleCV interface. You can see where this saving would happen here:

https://github.com/ingenuitas/SimpleCV/blob/master/SimpleCV/ImageClass.py#L1697

Here is the relevant PIL documenation:

http://www.pythonware.com/library/pil/handbook/image.htm

I think the code should look something like this:

fname = 'foo.jpg'
img = Image(fname)
if( img.quality > 80 ):
   img.save(fname,quality=80)

The default value for quality should be None, which defaults to the images quality at load time.

Create Image with Empty Path

Would it make sense to have the Image class raise an IOError when the source is of type str() and empty '' ? This would simplify our (@alokshankar and @Soli2ude) code wrapping SimpleCV, although checking for empty strings is easy.

What does having the '' source do for things (use case)?

Things that get past IOError lead to us hitting this (if we don't trap before instantiating an Image):

Traceback (most recent call last):
  File "face_detector.py", line 36, in <module>
    for result in executor.map(find_faces, lines):
  File "/usr/local/lib/python2.7/dist-packages/futures-2.1.2-py2.7.egg/concurrent/futures/_base.py", line 550, in map
    yield future.result()
  File "/usr/local/lib/python2.7/dist-packages/futures-2.1.2-py2.7.egg/concurrent/futures/_base.py", line 398, in result
    return self.__get_result()
  File "/usr/local/lib/python2.7/dist-packages/futures-2.1.2-py2.7.egg/concurrent/futures/_base.py", line 357, in __get_result
    raise self._exception
TypeError: CvArr argument 'arr' must be IplImage, CvMat or CvMatND. Use fromarray() to convert numpy arrays to CvMat or cvMatND

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.