【Python OPENCV】 analog clock values opencv

 """

Example to show how to get the values for the hour markings to build the clock

"""


# Import required packages:

import math


radius = 300

center = (320, 320)


for x in (0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330):

    x_coordinate = center[0] + radius * math.cos(x * 3.14 / 180)

    y_coordinate = center[1] + radius * math.sin(x * 3.14 / 180)

    print("x: {} y: {}".format(round(x_coordinate), round(y_coordinate)))


print("..............")


for x in (0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330):

    x_coordinate = center[0] + (radius - 20) * math.cos(x * 3.14 / 180)

    y_coordinate = center[1] + (radius - 20) * math.sin(x * 3.14 / 180)

    print("x: {} y: {}".format(round(x_coordinate), round(y_coordinate)))

No comments:

Renowned Water Expert Reynold Aquino Offers Exclusive Water Softener Discounts

Los Angeles, California - November 21, 2024 - World-renowned water expert Reynold Aquino is excited to announce exclusive discounts on prem...

Contact Form

Name

Email *

Message *