This is an implement of binary image segmentation based on total variation
. For more details in algorithm, please see in here.
Python3.x (Tested with 3.5)
opencv
PyQt4
scikit-learn
To use this code, please do:
-
Clone the repo:
git clone https://github.com/jfzhang95/TV_Segmentation cd TV_Segmentation
-
Install dependencies:
pip install opencv matplotlib scikit-learn pyqt4
-
To try the demo code, please run:
python demo.py
If installed correctly, the result should look like this:
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