Reader small image

You're reading from  Mastering OpenCV 4 with Python

Product typeBook
Published inMar 2019
Reading LevelExpert
PublisherPackt
ISBN-139781789344912
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Alberto Fernández Villán
Alberto Fernández Villán
author image
Alberto Fernández Villán

Alberto Fernndez Villn is a software engineer with more than 12 years of experience in developing innovative solutions. In the last couple of years, he has been working in various projects related to monitoring systems for industrial plants, applying both Internet of Things (IoT) and big data technologies. He has a Ph.D. in computer vision (2017), a deep learning certification (2018), and several publications in connection with computer vision and machine learning in journals such as Machine Vision and Applications, IEEE Transactions on Industrial Informatics, Sensors, IEEE Transactions on Industry Applications, IEEE Latin America Transactions, and more. As of 2013, he is a registered and active user (albertofernandez) on the Q&A OpenCV forum.
Read more about Alberto Fernández Villán

Right arrow

Advanced drawing

In this section, we are going to see how to combine some of the aforementioned functions to draw basic shapes in OpenCV (for example, lines, circles, rectangles, and text, among others) to render a more advanced drawing. To put all these pieces together, we have built an analog clock to show you the current time (hour, minutes, and seconds). For this, two scripts are coded:

  • analog_clock_values.py
  • analog_clock_opencv.py

The analog_clock_opencv.py script draws an analog clock, using cv.line(), cv.circle(), cv.rectangle(), and cv2.putText(). In this script, we first draw the static drawing. In this sense, you can see that there are two arrays containing fixed coordinates:

hours_orig = np.array(
[(620, 320), (580, 470), (470, 580), (320, 620), (170, 580), (60, 470), (20, 320), (60, 170), (169, 61), (319, 20),
(469, 60), (579, 169)])

hours_dest = np.array(
...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Mastering OpenCV 4 with Python
Published in: Mar 2019Publisher: PacktISBN-13: 9781789344912

Author (1)

author image
Alberto Fernández Villán

Alberto Fernndez Villn is a software engineer with more than 12 years of experience in developing innovative solutions. In the last couple of years, he has been working in various projects related to monitoring systems for industrial plants, applying both Internet of Things (IoT) and big data technologies. He has a Ph.D. in computer vision (2017), a deep learning certification (2018), and several publications in connection with computer vision and machine learning in journals such as Machine Vision and Applications, IEEE Transactions on Industrial Informatics, Sensors, IEEE Transactions on Industry Applications, IEEE Latin America Transactions, and more. As of 2013, he is a registered and active user (albertofernandez) on the Q&A OpenCV forum.
Read more about Alberto Fernández Villán