- Input image (and convert to "double precision image"???)
- Input: Image
- Output: Formatted image + additional info
- Description:
- Extract dimensions (and other information such as number of colour channels)
- Check for correct format
- Convert to correct format
- Build an empty graph (lattice; all edges weight=1) using dimensions of image (in pixels)
- Inputs: X, Y (dimensions of lattice)
- Outputs: Vertices(Nx2 matrix), Edges(Mx2 matrix)
- Description:
- Create (X*Y) number of nodes
- Create respective amount of edges with weight=1, connecting them accordingly. The connections will be such that each corner node will have 2 connections, each non-corner-outside node will have 3 connections, and each inside node will have 4 connections.
- Output Mx2 ‘vertices’ array and Nx2 ‘edges’ array
- Generate edge weights
- Inputs: Mx2 edges matrix, NxK list of nodal values (this will be Nx1 for now (1channel), and Nx3(3channel)), scaling factor(this scaling factor will affect the precision of the segmentation)
- Outputs: Mx1 matrix, indexed by the edges, containing the weight corresponding to that edge
- Description: The edges matrix is solely used for indexing. The equation implemented for weights is:
will fix later--->
Where i and j are adjacent nodes and ni and nj are the values at nodes i and j provided in the NxK nodal value array.
- Generate Laplacian matrix
- Input: edges matrix, nodes matrix
- Output: Laplacian matrix
- Description: Applies algorithm to generate Laplacian matrix by first finding the adjacency matrix.
- Determine locations of labels
- Using labels information from input
- Set up Dirichlet boundaries
- Using locations of labels.
- Solve Random Walker algorithm by solving the combinatorial Dirichlet problem
- Inputs: NxN Laplacian matrix, Lx1 vector specifying the boundary nodes (from step 6),
- Output: Nx1 vector specifying the new nodal values (which seed they belong to)
- Description: Finds the values of the non-boundary nodes
- Generate mask
- Extracted from the vector generated in step 7.