Are there wrong energies in the test reference for the image small2?

If I calculate them by hand, then energy[5] and as a consequence energy[8] are different values from those in the following image.

Shouldn’t

energy[5] = 130050 and

energy[8] = 260101

be the correct energies?

My algorithm computes exactly the values that I calculate by hand.

So is the reference broke or both my algorithm and my brain?

130050 is only the local energy of the 5th pixel. The energy array contains the total energy for each pixel. Therefore you have to add the minimum total energy of the three pixels above, which is energy[2] = 130050, to the local energy.

3 Likes

Oh so the total energy of a pixel is calculated with the total energies of the pixels above, not their local energies. Alright, now I see it in the project description as well.

Turns out my brain was broke once again…

Thanks for the answer!