smoothing received data from opencv...
in
Contributed Library Questions
•
2 years ago
Hi,
I seek some guidance on how to smooth out the readings received from opencv....
following is the code with problems...
int[] numReadings = new int [5];
int index = 0; // index of the current reading
int total = 0; // running total
int average = 0; // average
void setup(){
for (int i = 0; i < numReadings; i++) { // make array of readings
numReadings[i] = 0;
}
void draw(){
total = total - readings[index];
readings[index] = opencv.detects;
total = total + readings[index];
if (index >= numReadings)
index = 0;
average = total / numreadings;
}
I seek some guidance on how to smooth out the readings received from opencv....
following is the code with problems...
int[] numReadings = new int [5];
int index = 0; // index of the current reading
int total = 0; // running total
int average = 0; // average
void setup(){
for (int i = 0; i < numReadings; i++) { // make array of readings
numReadings[i] = 0;
}
void draw(){
total = total - readings[index];
readings[index] = opencv.detects;
total = total + readings[index];
if (index >= numReadings)
index = 0;
average = total / numreadings;
}
1