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)
| 24 | return lab |
| 25 | |
| 26 | def 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 | |
| 46 | def maxflow3d(I, P, param): |
| 47 | """ |
no outgoing calls
no test coverage detected