2
$\begingroup$

I have JPG images like below and each one is less than 200 KB. My webcam and the watch are in a fixed position. I want to analyze images and tell the exact time. I have huge number of images and training my algorithm wont be a problem. Any suggestions about packages that i can use? I am thinking about getting pixel color density values for each pixel and then building a neural network or a support vector machine. But i felt that there might be a better package or an algorithm to do the same.

enter image description here

$\endgroup$

1 Answer 1

3
$\begingroup$

I'd start by doing a little "feature engineering".

You know exactly what parts of the image carry semantic information: the positions of the hour, minute and (optionally) second hands. The rest of the image is irrelevant. You could manually mask it out, or you could subtract the average image from each one. If you have enough images (and consistent lighting), only the hands will remain. Now you just have to find the angle of each hand (to determine the time) and its length/width (to identify the hour/minute/second) hand. The Hough Transform (or one of its variants) is a standard technique for identifying lines in an image. Once you've got the two lines, it's trivial to convert their lengths and angles into a time.

This seems like a reasonable starting point to which you could add progressively more sophisticated image processing/machine learning techniques to deal with e.g., variations in lighting or movement. You could feed Hough-like features into your model, for example.

If you wanted to apply a less ad-hoc algorithm, I'd be tempted to think about it as a regression problem instead of a classification problem. Predicting a continuous value is going to be easier than performing a 720+ way classification (12 hours with 60 minutes each) and a prediction that misses the correct time by 1-2 minutes feels better than one which is off by 6 hours. As an added complication, time is circular on a watch: both 12:59 and 1:01 are reasonably close to 1:00.

$\endgroup$
2
  • $\begingroup$ idea of subtracting average image looks very interesting. Is there any R package that will help me with the same? I am planning to treat this as a regression problem .. $\endgroup$ Jan 20, 2015 at 21:22
  • $\begingroup$ Once you've read them in, colMeans() and subtraction operator - ought to be enough for the background removal. R-opencv provides R bindings for OpenCV, which has a Hough transform. There's also the PET package, which I've never actually used.... $\endgroup$ Jan 20, 2015 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.