{"id":13436304,"url":"https://github.com/luispedro/mahotas","last_synced_at":"2025-07-02T07:38:33.940Z","repository":{"id":40462037,"uuid":"495613","full_name":"luispedro/mahotas","owner":"luispedro","description":"Computer Vision in Python","archived":false,"fork":false,"pushed_at":"2025-02-25T03:47:04.000Z","size":4018,"stargazers_count":864,"open_issues_count":24,"forks_count":150,"subscribers_count":48,"default_branch":"main","last_synced_at":"2025-04-03T08:03:27.013Z","etag":null,"topics":["c-plus-plus","computer-vision","numpy","python","python-2","python-3"],"latest_commit_sha":null,"homepage":"https://mahotas.rtfd.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luispedro.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2010-01-31T00:13:06.000Z","updated_at":"2025-03-27T17:24:01.000Z","dependencies_parsed_at":"2022-07-14T23:46:08.105Z","dependency_job_id":"132067ca-3eee-4bfe-b5f5-8e41f354a0ec","html_url":"https://github.com/luispedro/mahotas","commit_stats":{"total_commits":1268,"total_committers":33,"mean_commits":38.42424242424242,"dds":"0.42586750788643535","last_synced_commit":"f7edeb22a4b47e6c5200c008a8e7386067d72443"},"previous_names":[],"tags_count":63,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luispedro%2Fmahotas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luispedro%2Fmahotas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luispedro%2Fmahotas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luispedro%2Fmahotas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luispedro","download_url":"https://codeload.github.com/luispedro/mahotas/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248225079,"owners_count":21068076,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","computer-vision","numpy","python","python-2","python-3"],"created_at":"2024-07-31T03:00:46.458Z","updated_at":"2025-04-10T13:10:09.790Z","avatar_url":"https://github.com/luispedro.png","language":"Python","funding_links":[],"categories":["Uncategorized","Python","Geospatial Library","图像数据与CV","Python Libraries"],"sub_categories":["Uncategorized","Python"],"readme":"# Mahotas\n\n## Python Computer Vision Library\n\nMahotas is a library of fast computer vision algorithms (all implemented\nin C++ for speed) operating over numpy arrays.\n\n[![Test mahotas](https://github.com/luispedro/mahotas/actions/workflows/test-python-package-with-conda.yml/badge.svg)](https://github.com/luispedro/mahotas/actions/workflows/test-python-package-with-conda.yml)\n[![Coverage Status](https://coveralls.io/repos/github/luispedro/mahotas/badge.svg?branch=master)](https://coveralls.io/github/luispedro/mahotas?branch=master)\n[![License](https://img.shields.io/badge/License-MIT-blue)](https://opensource.org/licenses/MIT)\n[![Downloads](https://static.pepy.tech/badge/mahotas)](https://pepy.tech/project/mahotas)\n[![Conda Downloads](https://anaconda.org/conda-forge/mahotas/badges/downloads.svg)](https://anaconda.org/conda-forge/mahotas)\n[![Install with conda](https://img.shields.io/badge/install%20with-conda-brightgreen.svg?style=flat)](https://anaconda.org/conda-forge/mahotas)\n\nPython versions 2.7, 3.4+, are supported.\n\nNotable algorithms:\n\n- [watershed](https://mahotas.readthedocs.io/en/latest/distance.html)\n- [convex points calculations](https://mahotas.readthedocs.io/en/latest/polygon.html).\n- hit \u0026 miss, thinning.\n- Zernike \u0026 Haralick, LBP, and TAS features.\n- [Speeded-Up Robust Features\n  (SURF)](https://mahotas.readthedocs.io/en/latest/surf.html), a form of local\n  features.\n- [thresholding](https://mahotas.readthedocs.io/en/latest/thresholding.html).\n- convolution.\n- Sobel edge detection.\n- spline interpolation\n- SLIC super pixels.\n\nMahotas currently has over 100 functions for image processing and\ncomputer vision and it keeps growing.\n\nThe release schedule is roughly one release a month and each release\nbrings new functionality and improved performance. The interface is very\nstable, though, and code written using a version of mahotas from years\nback will work just fine in the current version, except it will be\nfaster (some interfaces are deprecated and will be removed after a few\nyears, but in the meanwhile, you only get a warning). In a few\nunfortunate cases, there was a bug in the old code and your results will\nchange for the better.\n\nPlease cite [the mahotas paper](https://dx.doi.org/10.5334/jors.ac) (see\ndetails below under [Citation](#Citation)) if you use it in a publication.\n\n## Examples\n\nThis is a simple example (using an example file that is shipped with\nmahotas) of calling watershed using above threshold regions as a seed\n(we use Otsu to define threshold).\n\n```python\n# import using ``mh`` abbreviation which is common:\nimport mahotas as mh\n\n# Load one of the demo images\nim = mh.demos.load('nuclear')\n\n# Automatically compute a threshold\nT_otsu = mh.thresholding.otsu(im)\n\n# Label the thresholded image (thresholding is done with numpy operations\nseeds,nr_regions = mh.label(im \u003e T_otsu)\n\n# Call seeded watershed to expand the threshold\nlabeled = mh.cwatershed(im.max() - im, seeds)\n```\n\nHere is a very simple example of using `mahotas.distance` (which\ncomputes a distance map):\n\n```python\nimport pylab as p\nimport numpy as np\nimport mahotas as mh\n\nf = np.ones((256,256), bool)\nf[200:,240:] = False\nf[128:144,32:48] = False\n# f is basically True with the exception of two islands: one in the lower-right\n# corner, another, middle-left\n\ndmap = mh.distance(f)\np.imshow(dmap)\np.show()\n```\n\n(This is under [mahotas/demos/distance.py](https://github.com/luispedro/mahotas/blob/master/mahotas/demos/distance.py).)\n\nHow to invoke thresholding functions:\n\n```python\nimport mahotas as mh\nimport numpy as np\nfrom pylab import imshow, gray, show, subplot\nfrom os import path\n\n# Load photo of mahotas' author in greyscale\nphoto = mh.demos.load('luispedro', as_grey=True)\n\n# Convert to integer values (using numpy operations)\nphoto = photo.astype(np.uint8)\n\n# Compute Otsu threshold\nT_otsu = mh.otsu(photo)\nthresholded_otsu = (photo \u003e T_otsu)\n\n# Compute Riddler-Calvard threshold\nT_rc = mh.rc(photo)\nthresholded_rc = (photo \u003e T_rc)\n\n# Now call pylab functions to display the image\ngray()\nsubplot(2,1,1)\nimshow(thresholded_otsu)\nsubplot(2,1,2)\nimshow(thresholded_rc)\nshow()\n```\n\nAs you can see, we rely on numpy/matplotlib for many operations.\n\n## Install\n\nIf you are using [conda](https://anaconda.org/), you can install mahotas from\n[conda-forge](https://conda-forge.github.io/) using the following commands:\n\n```bash\nconda config --add channels conda-forge\nconda install mahotas\n```\n\n### Compilation from source\n\nYou will need python (naturally), numpy, and a C++ compiler. Then you\nshould be able to use:\n\n```bash\npip install mahotas\n```\n\nYou can test your installation by running:\n\n```bash\npython -c \"import mahotas as mh; mh.test()\"\n```\n\nIf you run into issues, the manual has more [extensive documentation on\nmahotas\ninstallation](https://mahotas.readthedocs.io/en/latest/install.html),\nincluding how to find pre-built for several platforms.\n\n## Citation\n\nIf you use mahotas on a published publication, please cite:\n\n\u003e **Luis Pedro Coelho** Mahotas: Open source software for scriptable\n\u003e computer vision in Journal of Open Research Software, vol 1, 2013.\n\u003e [[DOI](https://dx.doi.org/10.5334/jors.ac)]\n\nIn Bibtex format:\n\n\u003e   @article{mahotas,\n\u003e       author = {Luis Pedro Coelho},\n\u003e       title = {Mahotas: Open source software for scriptable computer vision},\n\u003e       journal = {Journal of Open Research Software},\n\u003e       year = {2013},\n\u003e       doi = {https://dx.doi.org/10.5334/jors.ac},\n\u003e       month = {July},\n\u003e       volume = {1}\n\u003e   }\n\nYou can access this information using the `mahotas.citation()` function.\n\n## Development\n\nDevelopment happens on github\n([https://github.com/luispedro/mahotas](https://github.com/luispedro/mahotas)).\n\nYou can set the `DEBUG` environment variable before compilation to get a\ndebug version:\n\n```bash\nexport DEBUG=1\npython setup.py test\n```\n\nYou can set it to the value `2` to get extra checks:\n\n```bash\nexport DEBUG=2\npython setup.py test\n```\n\nBe careful not to use this in production unless you are chasing a bug.\nDebug level 2 is very slow as it adds many runtime checks.\n\nThe `Makefile` that is shipped with the source of mahotas can be useful\ntoo. `make debug` will create a debug build. `make fast` will create a\nnon-debug build (you need to `make clean` in between). `make test` will\nrun the test suite.\n\n## Links \u0026 Contacts\n\n*Documentation*:\n[https://mahotas.readthedocs.io/](https://mahotas.readthedocs.io/)\n\n*Issue Tracker*: [github mahotas\nissues](https://github.com/luispedro/mahotas/issues)\n\n*Mailing List*: Use the [pythonvision mailing\nlist](https://groups.google.com/group/pythonvision?pli=1) for questions,\nbug submissions, etc. Or ask on [stackoverflow (tag\nmahotas)](https://stackoverflow.com/questions/tagged/mahotas)\n\n*Main Author \u0026 Maintainer*: [Luis Pedro Coelho](https://luispedro.org)\n(follow on [twitter](https://twitter.com/luispedrocoelho) or\n[github](https://github.com/luispedro)).\n\nMahotas also includes code by Zachary Pincus [from scikits.image], Peter\nJ. Verveer [from scipy.ndimage], and Davis King [from dlib], Christoph\nGohlke, as well as\n[others](https://github.com/luispedro/mahotas/graphs/contributors).\n\n[Presentation about mahotas for bioimage\ninformatics](https://luispedro.org/files/talks/2013/EuBIAS/mahotas.html)\n\nFor more general discussion of computer vision in Python, the\n[pythonvision mailing\nlist](https://groups.google.com/group/pythonvision?pli=1) is a much\nbetter venue and generates a public discussion log for others in the\nfuture. You can use it for mahotas or general computer vision in Python\nquestions.\n\n## Recent Changes\n\n### Version 1.4.18 (Jul 18 2024)\n\n- Fix bug in Haralick features and NumPy 2 (thanks to @Czaki, see [#150](https://github.com/luispedro/mahotas/pull/150))\n\n### Version 1.4.17 (Jul 13 2024)\n\n- Fix bug that stopped mahotas from working on Windows\n\n### Version 1.4.16 (Jul 3 2024)\n\n- update for NumPy 2\n- Add deprecated warning for freeimage\n\n\n### Version 1.4.15 (Mar 24 2024)\n\n- Update build system (thanks to @Czaki, see #147)\n\n### Version 1.4.14 (Mar 24 2024)\n\n- Fix code for C++17 (issue #146)\n\n\n### Version 1.4.13 (Jun 28 2022)\n\n- Fix freeimage testing (and make freeimage loading more robust, see #129)\n- Add GIL fixed (which triggered crashes in newer NumPy versions)\n\n### Version 1.4.12 (Oct 14 2021)\n\n- Update to newer NumPy\n- Build wheels for Python 3.9 \u0026 3.10\n\n### Version 1.4.11 (Aug 16 2020)\n\n- Convert tests to pytest\n- Fix testing for PyPy\n\n### Version 1.4.10 (Jun 11 2020)\n\n- Build wheels automatically (PR #114 by [nathanhillyer](https://github.com/nathanhillyer))\n\n### Version 1.4.9 (Nov 12 2019)\n\n- Fix FreeImage detection (issue #108)\n\n### Version 1.4.8 (Oct 11 2019)\n\n- Fix co-occurrence matrix computation (patch by @databaaz)\n\n### Version 1.4.7 (Jul 10 2019)\n\n- Fix compilation on Windows\n\n### Version 1.4.6 (Jul 10 2019)\n\n- Make watershed work for \u003e2³¹ voxels (issue #102)\n- Remove milk from demos\n- Improve performance by avoid unnecessary array copies in `cwatershed()`,\n  `majority_filter()`, and color conversions\n- Fix bug in interpolation\n\n### Version 1.4.5 (Oct 20 2018)\n- Upgrade code to newer NumPy API (issue #95)\n\n### Version 1.4.4 (Nov 5 2017)\n- Fix bug in Bernsen thresholding (issue #84)\n\n### Version 1.4.3 (Oct 3 2016)\n- Fix distribution (add missing `README.md` file)\n\n### Version 1.4.2 (Oct 2 2016)\n\n- Fix `resize\\_to` return exactly the requested size\n- Fix hard crash when computing texture on arrays with negative values (issue #72)\n- Added `distance` argument to haralick features (pull request #76, by\n  Guillaume Lemaitre)\n\n### Version 1.4.1 (Dec 20 2015)\n\n-   Add `filter\\_labeled` function\n-   Fix tests on 32 bit platforms and older versions of numpy\n\n### Version 1.4.0 (July 8 2015)\n\n-   Added `mahotas-features.py` script\n-   Add short argument to citation() function\n-   Add max\\_iter argument to thin() function\n-   Fixed labeled.bbox when there is no background (issue \\#61, reported\n    by Daniel Haehn)\n-   bbox now allows dimensions greater than 2 (including when using the\n    `as_slice` and `border` arguments)\n-   Extended croptobbox for dimensions greater than 2\n-   Added use\\_x\\_minus\\_y\\_variance option to haralick features\n-   Add function `lbp_names`\n\n### Version 1.3.0 (April 28 2015)\n\n-   Improve memory handling in freeimage.write\\_multipage\n-   Fix moments parameter swap\n-   Add labeled.bbox function\n-   Add return\\_mean and return\\_mean\\_ptp arguments to haralick\n    function\n-   Add difference of Gaussians filter (by Jianyu Wang)\n-   Add Laplacian filter (by Jianyu Wang)\n-   Fix crash in median\\_filter when mismatched arguments are passed\n-   Fix gaussian\\_filter1d for ndim \\\u003e 2\n\n### Version 1.2.4 (December 23 2014)\n\n-   Add PIL based IO\n\n### Version 1.2.3 (November 8 2014)\n\n-   Export mean\\_filter at top level\n-   Fix to Zernike moments computation (reported by Sergey Demurin)\n-   Fix compilation in platforms without npy\\_float128 (patch by Gabi\n    Davar)\n\n### Version 1.2.2 (October 19 2014)\n\n-   Add minlength argument to labeled\\_sum\n-   Generalize regmax/regmin to work with floating point images\n-   Allow floating point inputs to `cwatershed()`\n-   Correctly check for float16 \u0026 float128 inputs\n-   Make sobel into a pure function (i.e., do not normalize its input)\n-   Fix sobel filtering\n\n### Version 1.2.1 (July 21 2014)\n\n-   Explicitly set numpy.include\\_dirs() in setup.py [patch by Andrew\n    Stromnov]\n\n### Version 1.2 (July 17 2014)\n\n-   Export locmax|locmin at the mahotas namespace level\n-   Break away ellipse\\_axes from eccentricity code as it can be useful\n    on its own\n-   Add `find()` function\n-   Add `mean_filter()` function\n-   Fix `cwatershed()` overflow possibility\n-   Make labeled functions more flexible in accepting more types\n-   Fix crash in `close_holes()` with nD images (for n \\\u003e 2)\n-   Remove matplotlibwrap\n-   Use standard setuptools for building (instead of numpy.distutils)\n-   Add `overlay()` function\n\n### Version 1.1.1 (July 4 2014)\n\n-   Fix crash in close\\_holes() with nD images (for n \\\u003e 2)\n\n### 1.1.0 (February 12 2014)\n\n-   Better error checking\n-   Fix interpolation of integer images using order 1\n-   Add resize\\_to \u0026 resize\\_rgb\\_to\n-   Add coveralls coverage\n-   Fix SLIC superpixels connectivity\n-   Add remove\\_regions\\_where function\n-   Fix hard crash in convolution\n-   Fix axis handling in convolve1d\n-   Add normalization to moments calculation\n\nSee the\n[ChangeLog](https://github.com/luispedro/mahotas/blob/master/ChangeLog)\nfor older version.\n\n\n## License\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fluispedro%2Fmahotas.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fluispedro%2Fmahotas?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluispedro%2Fmahotas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluispedro%2Fmahotas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluispedro%2Fmahotas/lists"}