First page Back Continue Last page Overview Text

Notes:


But we can do exactly that using the following common trick. Remember, we need to be summing up terms inside the cycle using only the cycle edges. Suppose we want to find the area of the window, using the cycle edges, that is we need to add up 1’s for all window pixels. Let us consider one column of this graph. For the edge going from left to right, the red edge, we are going to assign weight which is equal to the sum of 1’s over all pixels below it. This weight is 5. For the edge going in the opposite direction, from right to left, we are also going to assign the sum of 1’s over all pixels below it, but this weight will be with negative sign. This sum is –2. Now if the cycle goes through the red and the blue edge, it will add 5 –2 to get 3 which is exactly the area of this cycle column. Thus when we sum up all the cycle edge weights we and up with the area inside that cycle.