This is a program developed in Python using OpenCV and Numpy. It can take a snapshot of a water meter and read the value indicated by the arm of the odometer.
A sample picture of the water meter is taken, with the hundredths reading indicated by the red arm of the odometer.
Then, three points (in red) pinpointing the center, the y-axis, and the x-axis are manually plotted. These points will be used as a frame for all future pictures.
The vertices of the box bounding the odometer is then created by adding and subtracting the length of the x-axis and y-axis.
Then, the picture is read and converted into HSV color format to filter out the red arm of the odometer.
The image is then denoised by first eroding to rid the image of outlying pixels, then dilating to fill in any holes in the middle. Finally, the image is eroded again to trim the edges.
The eigenvalues and right eigenvectors are then computed to determine the direction of the arm
The eigenvector corresponding with the largest eigenvalue is then projected onto the x and y axis, which can be calculated to give the angle of rotation and the odometer reading.