Code Monkey home page Code Monkey logo

morphsnakes's Introduction

Morphological Snakes

Build Status codecov

morphsnakes is an implementation of the Morphological Snakes for image segmentation. morphsnakes supports 2D images and 3D volumes.

anim_nodule anim_dendrite

Morphological Snakes [1][2] are a family of methods for image segmentation. Their behavior is similar to that of Active Contours like Geodesic Active Contours [3] or Active Contours without Edges [4]. However, traditional approaches for Active Contours require solving PDEs over floating points arrays, which is slow and might have numerical stability issues. Instead of PDEs, Morphological Snakes use morphological operators -such as dilation or erosion- over a binary array. This makes Morphological Snakes faster and numerically more stable than their traditional counterparts.

Two Morphological Snakes methods are available in morphsnakes:

  • Morphological Geodesic Active Contours, or MorphGAC, implemented in the function morphological_geodesic_active_contour,
  • Morphological Active Contours without Edges, or MorphACWE, implemented in the function morphological_chan_vese.

Installation

Option 1: Copy morphsnakes.py to your project

All the required code is contained in morphsnakes.py. You can copy this file into your own project with

wget https://raw.githubusercontent.com/pmneila/morphsnakes/master/morphsnakes.py

Option 2: pip install

It is also possible to install morphsnakes with pip

pip install morphsnakes

Getting started

The file examples.py contains multiple examples of MorphGAC and MorphACWE. You can take any example from that file as a starting point for your project.

What are the differences between MorphGAC and MorphACWE?

MorphACWE

MorphACWE works well when pixel values of the inside and the outside regions of the object to segment have different averages. Unlike MorphGAC, MorphACWE does not require that the contours of the object are well defined, and it can work over the original image without any preprocessing.

MorphACWE is much easier to setup and use than MorphGAC, and much more robust to noise. You should try using MorphACWE first, and only switch to MorphGAC when it is clear to you that MorphACWE is not suitable for the kind of images you are working with.

anim_lakes anim_europe

MorphGAC

MorphGAC is suitable for images with visible contours, even when these contours might be noisy, cluttered, or partially unclear. It requires, however, that the image is preprocessed to highlight the contours. This can be done using the function inverse_gaussian_gradient, although you might want to define your own version. The quality of the MorphGAC segmentation depends greatly on this preprocessing step.

anim_starfish anim_nodule

References

[1]: A Morphological Approach to Curvature-based Evolution of Curves and Surfaces, Pablo Márquez-Neila, Luis Baumela and Luis Álvarez. In IEEE Transactions on Pattern Analysis and Machine Intelligence (PAMI), 2014, DOI 10.1109/TPAMI.2013.106

[2]: Morphological Snakes. Luis Álvarez, Luis Baumela, Pablo Márquez-Neila. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition 2010 (CVPR10).

[3]: Geodesic Active Contours, Vicent Caselles, Ron Kimmel and Guillermo Sapiro. In International Journal of Computer Vision (IJCV), 1997, DOI:10.1023/A:1007979827043

[4]: Active Contours without Edges, Tony Chan and Luminita Vese. In IEEE Transactions on Image Processing, 2001, DOI:10.1109/83.902291

morphsnakes's People

Contributors

borda avatar chsasank avatar pmneila avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.