Pymorph is a collection of pure python implementations of many image morphology functions.
Pymorph is still available and bug-free, but I am not adding any new features. My other computer vision package, mahotas, is a C++ implementation and is much faster.
It started small, but now has almost all of the functionality of pymorph and a lot of functionality that pymorph did not have. Even for the functionality that is shared with pymorph, mahotas is almost always a better choice (mainly for the fact that it is faster).
Additionally, mahotas has functionality that pymorph never had (nor will have).
You can use [easy_install]{.title-ref} or `pip`::
easy_install pymorph
pip install pymorph
If you want the code, it can be downloaded as a source tar.gz file from pypi. Installation follows the typical
python setup.py install
Autogenerated API Docs are very complete.
The book Hands-On Morphological Image Processing provides some of the background, but is based on the older release.
Since there is feature stability, I release on PyPI whenever I have fixed a new bug (to make it easy for people who use [easy_install]{.title-ref} or [pip]{.title-ref} to keep up).
For more minor fixes (documentation reformatting), you can check the continuous release on github.
The package is very stable, so tracking the development release should not cause you any problem.
The official forum for discussion of pymorph issues is the pythonvision mailing list. Also, check out pythonvision.org while you're at it.
For bug reports, mail me. If you report a bug, I will try to fix it. If it has a unit test, I promise to fix it.
Currently, there are no known bugs, but, because the package does not have automatic tests and there have been interface changes in numpy (when compared to Numeric), there are certainly unknown bugs, which is why I need people to report them.
New contributions are welcome. At best, start from the github version and either branch it or just email me a patch. Right now, good test bug reports are a needed contribution.
Once these are done, I will release this as 1.0
This started as the Python Morphology Toolbox. It was a very nice piece of software, written by Roberto A. Lutofu and Rubens C. Machado. Unfortunately, the code had been allowed to rot and did not work with the more recent numpy libraries.
Since discovering their code, I have been using it and making changes so that it runs with modern numpy. I have now adopted the package and am reworking it more deeply than just a fix here and there.
The most important change has been the removal of superfluous functions. Functions that deal with image input/output or image display have been removed. The reason is that matplotlib is a much better implementation of this. I see no point in going through the effort of maintaining thin wrappers around its functionality. For plotting, use matplotlib (it also has a imread function based on PIL).
I removed the mm prefix from function names. Function name prefixes are needed in Matlab, which does not have namespaces, but they're un-Pythonic (given that Python has namespaces).
I also changed other small things, including removing some functions which were superfluous. See the CHANGES_SINCE_08 file in the distribution. A module called pymorph.compat contains old function names as well as all the functions that were removed. If you have code which depends on the old names, use this. Otherwise, I recommend you use the new names. I will remove [compat]{.title-ref} for version 1.0 as I would like that version to be a clean one. Argument names have changed (and are becoming standartised across the package). These changes should only affect you if you call functions using argument name syntax ([f(arg=2)]{.title-ref} instead of [f(2)]{.title-ref}).
I have also implemented a couple of missing functions (like watershed).
There have been many bugfixes across the package too.
Copyright (c) 2009-2023. Luis Pedro Coelho. All rights reserved.