/TV_Segmentation

Python implement of Total Variation Image Segmentation

Primary LanguagePythonMIT LicenseMIT

TV_Segmentation

This is an implement of binary image segmentation based on total variation. For more details in algorithm, please see in here.

Dependencies

Python3.x (Tested with 3.5)
opencv
PyQt4
scikit-learn

Installation

To use this code, please do:

  1. Clone the repo:

    git clone https://github.com/jfzhang95/TV_Segmentation
    cd TV_Segmentation
  2. Install dependencies:

    pip install opencv matplotlib scikit-learn pyqt4
  3. To try the demo code, please run:

    python demo.py

If installed correctly, the result should look like this: results

Usage

Note that in demo.py, we only use very simple unary term. More advanced unary terms are implemented in GraphMaker.py and GraphMaker_kmeans.py, they need user input to build prior knowledge. CutUI.py is a GUI implemented for User Interactivation.

The primal dual total variation optimization method is implemented in utils.py

License

MIT