Saturday, January 15, 2011

Level Sets and Image Segmentation with Python

I ported the Matlab code that was written by Li, Xu, Gui and Fox for their paper Level Set Evolution Without Re-initialization: A New Variational Formulation, into Python. Li et al. use level sets with a new approach and are able to segment an image succesfully. Some screenshots as well as the code itself is below.







Code

12 comments:

  1. Thanks for the code, I intend to use it in a project, what license applies to it? GPL?

    ReplyDelete
  2. I want to implement the same for lip segmentation. How can I input the image of lip in jpg format to this code ?

    ReplyDelete
    Replies
    1. plt.imread should be able to display jpg files. If not u can convert the image with ImageMagic convert command

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Could you please add the link to the original Matlab source?

    ReplyDelete
    Replies
    1. I do not have the link nor the Matlab files anymore. Sorry.

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Hi,

    I don't understand how to compile the code, can you help me please? When I begin with plot_phi, I have the error "name'phi' is not defined" and when I begin with active1, "plot_phi is not defined".

    ReplyDelete
  7. I dont maintain the active-.py files anymore, the only codes you'll need are in the pde_level.tex. There are two blocks inside the tex file, copy them to seperate files, add import numpy as np and import matploblib.pylab as plt to the beginning of both, and run them, they will generate the png outputs seen in the doc.

    ReplyDelete
  8. Thanks a lot,
    Have a good day
    Juliette

    ReplyDelete
  9. This is very interesting, You are a very skilled blogger. I have joined your rss feed and look forward to seeking more of your great post. Also, I have shared your site in my social networks! https://python.engineering/pylatex-module-in-python/

    ReplyDelete