In this program, we will draw a rectangle using the OpenCV function rectangle(). This function takes some parameters like starting coordinates, ending coordinates, color and thickness and the image itself.
OpenCV rectangle() is a function which is focused on designing algorithm capable of solving problems related to computer vision. The OpenCV rectangle function is utilized in order to draw a rectangle a rectangular shaped hollow box on any image which is provided by the user.
To create shapes like Rectangle, we use the create_rectangle(x,y, x+ width, y+ height, **options) method. We can configure the item on the canvas by adding properties such as width, height, fill and bg, border width, etc.
You can also find the square of a given number using the exponent operator in python. It is represented by "**". While applying this method, the exponent operator returns the exponential power resulting in the square of the number. Note that the statement “a**b” will be defined as “a to the power of b”.
Approach: Create a black window with three color channels with resolution 400 x 300. Draw three lines which are passing through the given points using the inbuilt line function of the OpenCV. It will create a triangle on the black window.
rectangle() function, as the name describes this function is used to draw a circle using wand. drawing object in Python. rectangle takes many arguments like left, top, right, bottom, width, height etc.
The rectangular fraction model means a rectangle divided into equal parts. The equal parts may be halves, thirds, fourths, and so on, depending on how many equal parts you chop the whole into. Remember that in any fraction, the number on the top is the numerator, and the number on the bottom is the denominator.