-
Notifications
You must be signed in to change notification settings - Fork 162
Open
Description
Hi! I have your implementation of ViBe+ reviewed and realized that in function
void ViBePlus::UpdatePixSampleSumSquare(int i, int j, int k, int val)
{
double res = 0;
UpdatePixSampleAve(i, j, k, val);
for(int m = 0; m < num_samples; m++)
res += pow(samples[i][j][m] - samples_ave[i][j], 2);
res /= num_samples;
samples_sumsqr[i][j] = res;
}
the loop is useless. Because it's adding to res a value of expression pow(samples[i][j][k] - samples_ave[i][j], 2) <num_samples> times. Then res is dividing by num_samples. So this loop and dividing are equals to res = pow(samples[i][j][k] - samples_ave[i][j], 2).
That is why I'm suggesting that there must be a samples[i][j][m] instead of samples[i][j][k]. Otherwise this loop is useless.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels