OpenCV  4.1.0
Open Source Computer Vision
Basic Drawing

Next Tutorial: Random generator and text with OpenCV

Goals

In this tutorial you will learn how to:

[block] [block]

Code

[block] [block] [block]

Explanation

Since we plan to draw two examples (an atom and a rook), we have to create two images and two windows to display them. [block]

[block] [block]

We created functions to draw different geometric shapes. For instance, to draw the atom we used MyEllipse and MyFilledCircle: [block]

[block] [block]

And to draw the rook we employed MyLine, rectangle and a MyPolygon: [block]

[block] [block]

Let's check what is inside each of these functions: [block]

MyLine

[block] [block] [block]

MyEllipse

[block] [block] [block]

MyFilledCircle

[block] [block] [block]

MyPolygon

[block] [block] [block]

rectangle

[block] [block] [block]

Result

Compiling and running your program should give you a result like this:

Drawing_1_Tutorial_Result_0.png