Although I was not able to complete this project, the goal was to use belief propogation to segment the image into four labels. OpenCV Code