Questions about Task 3.2

I am currently not sure about the Task, espacially now the function calculate_energy:

I have to calculate the Index of the pixel with the lowest energy on the bottom row, but what do i do ater i have this Index, because it’s void function there is no return value, do i have to print it?

I also have tocal culate the total energy but to do so i need local energy for the pixels, are these given somehow or do i have calculate it before.

Thanks in advance

Hi David,

I am a bit confused by your question, as it sounds like you are mixing up two functions.

Calculating the index of the pixel with the lowest energy in the last row is done in calculate_min_energy_column, which has the return type int, not in calculate_energy. You can return that index from calculate_min_energy_column, there is no need to print it anywhere (other than for debugging purposes maybe).

The function calculate_energy is only used to calculate and fill the energy matrix. As you described, this process requires the local energy, which is not given, but should be calculated by you before calculating the total energy. Section 1.1 of the project description details how to calculate the local energy for every pixel.

Does this answer your question?

Lucas

2 Likes

I think there were some misunderstanding, also coming from confusions of the function description given in the code. Thanks for the answer