Implementation of a graph in an image using the Energy function

I tried to extract hair from a given image, as described in a research paper , using the concept of minimizing energy. The energy function depends on both probabilistic probability and YCrCb. The energy function is defined as:

𝐸(𝑓x)= 𝐸data(𝑓x)+𝐸smooth(𝑓x). 

𝐸data (𝑓x) = - Ξ£ (log𝑃 (I (x) | 𝑓x) + log𝑃sel (𝑓x)) [Previous probabilistic model]

𝐸 Smooth (𝑓x) = Ξ£ Ξ΄ (𝑓x β‰  𝑓x) exp (- || π‘Œ (x𝑖) -π‘Œ (x𝑗) || ^ 2 / Ξ³) [Prior YcrCb color model]

I am confused about how to designate this graph (image pixels are considered as nodes of the graph). I tried to mark the graph using the following approach, but the results are not as expected:

 def get_Edata(prob_dist, ycrcb_dist, img_y, img_x, pix): e_data = 0 Y, Cr, Cb = pix if ycrcb_dist[int(Y/4)][int(Cr/4)][int(Cb/4)] > 0 and prob_dist[img_y][img_x]>0: e_data = -1*(math.log(ycrcb_dist[int(Y/4)][int(Cr/4)][int(Cb/4)], 10) + math.log(prob_dist[img_y][img_x], 10)) return e_data def get_ESmooth(normalization_constant, pix_1, pix_2): return math.exp(-(math.ceil(pix_1[0] - pix_2[0])**2)/normalization_constant) 

And adding weight between nodes in the graph, I use:

 #adding the edges between neighbouring pixels. img_graph.add_edge(central_node, neighbour_nodes, eSmooth, 0) #adding the edges from source to node and from node to sink. img_graph.add_tedge(central_node, weight_source, max_val_weight-source) 

I think the problem is with max_val_weight-source , because changing the value for some lower integer gives me relatively good results, but this is the wrong way to do this.

Also, changing the eSmooth value to 0 does not affect the output?

I would really appreciate it if someone could shed light on this context.

+7
graph image-processing image-segmentation max-flow
source share

No one has answered this question yet.

See related questions:

1518
Image Processing: Enhanced Coca-Cola Can Recognition Algorithm
271
Python Graphics Library
10
image segmentation using a graph cut with start points
2
3D graphic with previous form
one
Graphic cuts and edge removal
0
advanced graphics library: dfs filter filter nodes
0
Initialization graph for the Push-Relabel algorithm
0
computer vision: setting up segmentation. Graph reduction potentials
0
MRF and Graph Cut: from equation to code?
-2
Binary image segmentation

All Articles