Calculating energy pointer

From what I’ve read in the previous post, integer pointer energy is a one dimensional array that stores the total energy of each pixel of the image. How am I supposed to store the total energy of each pixel? Once I have calculated the local energy using diff_color, and use it to calculate the total energy, do I store it as with the energy of each index of first row followed by the second row and so on?

Also, while calculating the local energy, should I consider all the pixels with width less than int constant ‘w’ and ignore the pixels p from w\leq p\leq (int\to w) or should I consider all the pixels up to (int\to w)?

Kinda like this: energy[index_here] = total_energy. index_here can be computed using yx_index. You do not need to store the local energy.

You handle the pixels from 0 to w-1 (inclusive).

Writing this way makes your post rather hard to understand. Just omit the type when writing about your code, or if you have to include it, write like this:

energy (of type int*)