python-pillow/Pillow — pull request #691 by dov (2014-06-04 20:14:18+00:00)
Title: Initial commit of binary morphology addon.

This pull request contains an initial implementation of a binary mathematical morphology (see: http://en.wikipedia.org/wiki/Mathematical_morphology) addon for Pillow. It is used to apply morphological operators on PIL images of mode 'L' where each pixel is considered binary. The library contains support for applying morphological operators on an image and returns a modified image. E.g. to run a erosion operator on an image do:

mop = ImageMorph.MorphOp(op_name='erosion8')
count,imgOut = mop.apply(img)

The library also supports returning matching features as a python list. E.g. the following code returns all corners found in an binary image:

mop = ImageMorph.MorphOp(op_name='corners')
corners = mop.match(image)

Please let me know if you find this suitable for Pillow or if you would rather I keep it in a separate library.