Monday, May 30, 2011

Initial backend work

We have started with the backend system. To recap, it will enable us to provide implementation backings for functions from various frameworks.

I've started with the Sobel operation, and implemented it in both opencv and opencl. At the same time I've reworked the numpy version as well so that identical results can be obtained. With different implementations at your disposable a great benefit is the way that you can test and benchmark different algorithms.

The working idea for now is to make a decorator that one can add to functions:

@add_backends
def sobel(image):
    # numpy implementation
    ...

This will add an optional backend implementation parameter to the function that the function will try to use:

# use the opencv sobel implementation
sobel(image, backend="opencv")
# use the opencl implementation on an available gpu
sobel(image, backend="opencl")

If the specified implementation is not found, we fall back to the default numpy backend. For global backend selections we are thinking of something in the following line:

use_backend("opencl")

This will try to use opencl wherever possible.

An alternative thought to our current setup is to specify it more explicitly:

opencv.sobel(image)

The following week we will try to finalize this API and implement a few more functions.

Saturday, April 30, 2011

Accepted for the Google Summer of Code!

Our proposal was accepted for the Google Summer of Code 2011.
Now it is time to tool up and cover some groundwork before we begin!

Sunday, April 17, 2011

Edges

Edge detection has always played some part in my illumination invariant algorithms, so I thought it would be a good idea to try getting it into the Scikit. The CellProfiler project has released their algorithms, so I've ported it together with its well written tests. It is rudimentary but a good foundation for a start.

Interestingly the Sobel functions of opencv and ndimage gives different results, perhaps a good idea to look a bit into the source to see what differs.
My branch is hosted at the following location:
Pull request and commit for this patch:

Friday, April 8, 2011

GSOC2011

This is my proposal to improve scikits.image for the Google Summer of Code 2011.

Multiple computational backend support

While scikits.image is currently built on NumPy, leveraging the graphical processing unit (GPU) by using PyOpenCL (http://mathema.tician.de/software/pyopencl) would provide a significant speed increase for certain parallelizable algorithms.

Similarly, other libraries such as CorePy (http://www.corepy.org) and Theano (http://deeplearning.net/software/theano) provide benefits over NumPy under certain circumstances.

To leverage these libraries, a backend system will be implemented whereby algorithms can easily be run on different libraries or devices. For example, we could execute a color conversion on the GPU as:


from scikits.image import backend

rgb2hsv(x, backend=backend('opencl'))


Video Input and Output

The scikit has excellent input/output plugin facilities, but currently does not support video reading, writing or display. Existing open source video reader libraries will be wrapped using Cython (http://cython.org), whereafter the existing ImageCollection class can be modified to display them. The possibility of wrapping a camera acquisition library can be investigated.


Image Processing Algorithms

The number of algorithms provided by the library is currently limited. The addition of certain key algorithms would increase its usefulness dramatically. I propose adding the following algorithms, implemented in Cython:

  • Feature detection (probabilistic Hough transform, STAR, FAST)

  • Segmentation (graph cuts and watershed)

  • Geometrical transformations (distortion removal)

This goal seems ambitious, but for many algorithms existing wrappers exist which may be re-used, for example code from CellProfiler at MIT’s Broad Institute (released under a BSD license).


Documentation

To improve adoption of the project, I’d like to write an introductory tutorial and improve the existing documentation.