Pages

Wednesday, November 12, 2008

Poor Man's ADC

Can you use a commodity webcam as an el-cheapo analog to digital converter (ADC)? The folks at slashdot want to know so they can reduce their energy consumption. Here's the example image:Octave has plenty of image processing functions in the image package from Octave Forge. Here's the edges detected with the built-in edge() function:Now we need to perform a smart correlation with the gauge needles so we can map the angle of the needle to a decimal value in [0,10). One way to do it would be to zoom in on the center of the gauge:Then we can perform a simple least squares regression on the non-zero pixel locations to get a rough estimate of the "slope" of the needle.

1 comment:

One of the other commenters at slashdot found this example using Matlab too. A little bit different, there's only one gauge in the picture, so he can apply a transform to the entire image to find the longest line (the needle), and then map that into the gauge reading.