Mahotas: computer vision in Python

Fork me on GitHub

A dedicated mahotas page with documentation is available at This page is just a summary.

If you are using mahotas in a scientific publication, please cite:

Coelho, L.P. 2013. Mahotas: Open source software for scriptable computer vision. Journal of Open Research Software 1(1):e3, DOI:


Mahotas is a set of functions for image processing and computer vision in Python. It was originally designed for bioimage informatics, but is useful in other areas as well.

It is completely based on numpy arrays as its datatype. It has its heavy routines implemented in clean C++ in a way that is both very clean, type independent (using templates), and fast.

All of the code is self contained and it has no other dependencies than numpy. Freeimage or imread are an optional dependency if you want to use the imread and imsave functions.

The code is well documented (all public functions are extensively documented) and well tested (almost 100% test coverage). It has no known bugs (if you email me a bug report with a clear test case, I will typically fix it in less than 24 hours).

Slide deck about mahotas and Python for bioimage informatics.


  • SURF
  • watershed
  • thresholding
  • convex hull computation
  • polygon drawing
  • feature computation: Haralick textures, local binary patterns, and Zernike moment
  • distance transform
  • freeimage & imread interface
  • ...


You can get the code from pypi or the cutting edge from github. Instalation should be possible using::

pip install mahotas


easy_install mahotas

You can also find Windows packages here by Christoph Gohlke at UCI. He also has other useful Python packages.

For FreeBSD, mahotas is available in the ports section.


<iframe src="" allowtransparency="true" frameborder="0" scrolling="0" width="152px" height="30px"></iframe>

Development happens on github


Make sure you check out the documentation.

The official forum for discussion of mahotas issues is the pythonvision mailing list. Also, check out while you're at it.

For bug reports and fixes use the github issue tracker. 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.

Copyright (c) 2009-2023. Luis Pedro Coelho. All rights reserved.