MCPcopy Create free account
hub / github.com/HiLab-git/SimpleCRF / interactive_maxflow2d

Function interactive_maxflow2d

examples/demo_maxflow.py:26–44  ·  view source on GitHub ↗

maxflow for 2D interactive image segmentation. Only binary segmentation is supported. input parameters: I : a numpy array of shape [H, W], or [H, W, C] where C should be 3. type of I should be np.float32 P : a probability map of shape [H, W, L], where L=

(I, P, S, param)

Source from the content-addressed store, hash-verified

24 return lab
25
26def interactive_maxflow2d(I, P, S, param):
27 """
28 maxflow for 2D interactive image segmentation. Only binary segmentation is supported.
29 input parameters:
30 I : a numpy array of shape [H, W], or [H, W, C] where C should be 3.
31 type of I should be np.float32
32 P : a probability map of shape [H, W, L], where L==2 is the number of classes
33 type of P should be np.float32
34 S : a numpy array showing user interactions, shape should be [H, W, L], where L == 2
35 type of S should be np.uint8
36 param: a tuple giving parameters of CRF (lambda, sigma), where
37 lambda : weight of smooth term, e.g. 20.0
38 sigma : std intensity value, e.g., 10
39
40 output parameters:
41 lab : a numpy array of shape [H, W], where pixel values represent class indices.
42 """
43 lab = maxflow.interactive_maxflow2d(I, P, S, param)
44 return lab
45
46def maxflow3d(I, P, param):
47 """

Callers 1

demo_interactive_maxflowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected