Calculation with integral image