Git Product home page Git Product logo

snakes-in-a-plane's Introduction

Snakes in a Plane

Active contour model (aka snakes) implemented in python.

An active contour model is an image analysis technique which evolves a curve to find boundaries in images. Skimage has an implementation of this algorithm, but like many of their functions, it does a lot of preprocessing "under the hood."

This code requires only the standard python scientific stack: numpy, scipy, matplotlib, and skimage. The main functions are fit_snake (and snake_energy) in BKlib.py; this function will evolve a closed contour to fit an image. Starting with an initial guess for the boundary points, fit_snake shifts the points around until they sit at a local minimum of the function snake_energy. The snake energy is pretty much as described in the wikipedia article: internal energy terms penalizing stretching, and encouraging smoothness; and external energy terms that push the curve towards edges.

I've included some examples code and data to demonstrate how it works. Just clone, and run python snakes_demo.py. It will show the results of the image preprocessing, initialize the snake/contour from one the of the supplied .npy data files, and show an animation of the fitting procedure.

These functions form the basis of the scripts in one of my other repos.

snakes-in-a-plane's People

Contributors

brikeats 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.