Energy Matrix Creation

The above figure, illustrates the creation of table entry (i,j). i is represented by the number of the table, moving from left to right, and j is represented by the row of each table. The first column in a table contains the position of snaxel i-1 that yields the minimum energy, and the second column contains this minimum energy.

In the above figure, values for the center table, and the energy function results indicated above each arrow, with i being 2 and j being 4, the (i,j) node would take the minimum value obtained from adding the previous value for each node with the results of the energy function at the current position. In this example, node (2,4) obtains the value 30 which is a result of adding the value of node (1,1), 16, with the value of the energy function, 14. Node (1,1) is used because it yields the minimum sum. Since node (1,1) is chosen, 1 is stored in the first column of the table.