I was trying to solve this problem and found this in wiki. I am referring to the fourth application here, "Image Segmentation Problem". I think I need to understand this to solve the above problem. But the wiki article only says what to do to solve image segmentation problem. But it doesn't explain the logic or idea behind it. Can anyone help me to understand it ? This is what is written in Wikipedia: