Lab Model Motion Tracking with OpenCV, Python and InfluxDB
I was recently asked to come up with a way of measuring the efficiency of a model representing an energy harvesting device.

Efficiency can be thought of as the relationship between input and output energy
Efficiency (%) = Output Power (W) / Input Energy (W)
So we’d need to measure input and output energy and perhaps some steps along the way if we’re interested in specific attributes of the model that could influence efficiency (like flexibility of the materials involved).
Power (in Watts or Joules/second) = Work (Joules) / Time (s)
Work (Joules) = Force x Distance
In order to determine input power we’d need to measure a force applied over distance. We can take some inspiration from the world of cycling, where measurement of power is a big thing :

An early bicycle power-measurement crank/front chainring, missing the control electronics.
In the image above, the part with the glue contains a strain gauge. The Strain gauge allows the measurement of force and as the diameter of the chain ring (the cog teeth) is known, if you know the RPM of the chainring, you’ll know distance travelled. The two, when multiplied, give work done, and therefore power output.

Power output on a bicycle over the course of a 2 hour ride.
So attaching strain gauges to our model will allow us to measure and log forces acting on the model, but what about distance ? Enter OpenCV.

An Aruco tracking marker.
OpenCV is a fairly generic image/video manipulation library which provides the building blocks for implementing other video-based tasks. One potential application is tracking ArUco markers. Presumably the “Ar” means augmented reality and the “Uco” is from the University of Cordoba, where it was developed.

OpenCV’s “contrib” ArUco detection code allows not only for detection of relative movement but also of “pose”/the orientation of the barcode in space - which is pretty amazing.
You can head over to https://github.com/aquarat/aruco-pg-demo for demo code and sample video file.