Update data term of Gibbs energy in GrabCut
I was going through the GraphCut algorithm and I wanted to update the data term of the Gibbs energy to the following:
where, and . p^f and p^b are the Gaussian Mixture Model (GMM) with 4 and 8 components respectively. I was going through the code of GraphCut, where I can see that smoothness is calculated in calcNWeights() function. But what I couldn't find is the calculation of data term. How is the data term is calculated in the code and how to update it ?