Ask Your Question

Revision history [back]

Here is a different approach.

The image below shows several steps available in OpenCV.

  1. Find the circle of the clock and use the warpPolar transformation.
    Rotate this image by 180 to get the 2nd image.

  2. Apply a dilation with a wide Rect kernal about 120 x 1 to get the 3rd image.

  3. Do an inverse binary threshold to get the last image.

You can then filter the contours in this last image by area and center x position to leave only the contours that would be the hour, minute and second hand.

We know that 3:00 will be on top, 9:00 in the middle and 6:00 at the bottom so it shouldn't be too difficult to map the center y values of the remaining contours to their values on the clock.

image description