I am using a Kinect and openCV to detect blobs.
I grab the position of the blob (centroid) but because of noise in the image detection, this position is noisy and unstable.
what would be the way to smooth values ?
(i saw ofLerp but i don’t undertand how this works)
I have a similar problem but I didn’t manage to sort it yet. HOw do I get the correct position1 and newPosition?
I have a stream of position from ofxFaceTracker. what I am doing is
in setup();
//initialise buffer Position
bufferPositionSize = 16; // also tried 1, 2,4,512
bufferPosition = new ofVec2f[bufferPositionSize];
tempindexPos = new int[bufferPositionSize];
//all indices start from 0
for (int i = 0; i<bufferPositionSize; i++) {
tempindexPos [i] = NULL;
}
in update();
I am cycling the stream in the buffer.
//ring buffer for smoothing the scale
for (int i = 0; i<bufferPositionSize; i++) {
bufferPosition[tempindexPos[i]] = ofVec2f ( anchor ); // anchor is the anchor point
tempindexPos[i]++;
if (tempindexPos[i] == bufferPositionSize) {
tempindexPos[i]= 0;
}
}
and then in draw I translate the position using this function
I was expecting to have a smoother transition with a bigger buffer, instead I get the contrary. If the buffer is 1 is more fluid if is 2,4,16, it’s more and more jittery. if it’s 512 doesn’t even start…