I am doing pose estimation with AruCo markers using OpenCV in C++ on live webcam feed. My fps is 30 so when I am printing translation vectors, I am getting continues values of translation vectors i.e. 30 values per second. These values are fluctuating, therefore to make it more stable I want to average first 30 values and then print it and then next 30 values and print it so on. How to do it?. My code is as follows
aruco::estimatePoseSingleMarkers(markerCorners, arucoSquareDimension, cameraMatrix, distanceCoefficients, rotationVectors, translationVectors);
for (int i = 0; i < markerIds.size(); i++)
{
aruco::drawAxis(Croppedframe, cameraMatrix, distanceCoefficients, rotationVectors[i], translationVectors[i], 0.1f);
cout << translationVectors[i] << "translation" << "vector" << markerIds[i] << endl;
}