@@ -33,21 +33,21 @@ To draw a line, you need to pass starting and ending coordinates of line. We wil
...
@@ -33,21 +33,21 @@ To draw a line, you need to pass starting and ending coordinates of line. We wil
img = np.zeros((512,512,3), np.uint8)
img = np.zeros((512,512,3), np.uint8)
# Draw a diagonal blue line with thickness of 5 px
# Draw a diagonal blue line with thickness of 5 px
img = cv2.line(img,(0,0),(511,511),(255,0,0),5)
cv2.line(img,(0,0),(511,511),(255,0,0),5)
Drawing Rectangle
Drawing Rectangle
-------------------
-------------------
To draw a rectangle, you need top-left corner and bottom-right corner of rectangle. This time we will draw a green rectangle at the top-right corner of image.
To draw a rectangle, you need top-left corner and bottom-right corner of rectangle. This time we will draw a green rectangle at the top-right corner of image.
To draw a circle, you need its center coordinates and radius. We will draw a circle inside the rectangle drawn above.
To draw a circle, you need its center coordinates and radius. We will draw a circle inside the rectangle drawn above.
::
::
img = cv2.circle(img,(447,63), 63, (0,0,255), -1)
cv2.circle(img,(447,63), 63, (0,0,255), -1)
Drawing Ellipse
Drawing Ellipse
--------------------
--------------------
...
@@ -55,7 +55,7 @@ Drawing Ellipse
...
@@ -55,7 +55,7 @@ Drawing Ellipse
To draw the ellipse, we need to pass several arguments. One argument is the center location (x,y). Next argument is axes lengths (major axis length, minor axis length). ``angle`` is the angle of rotation of ellipse in anti-clockwise direction. ``startAngle`` and ``endAngle`` denotes the starting and ending of ellipse arc measured in clockwise direction from major axis. i.e. giving values 0 and 360 gives the full ellipse. For more details, check the documentation of **cv2.ellipse()**. Below example draws a half ellipse at the center of the image.
To draw the ellipse, we need to pass several arguments. One argument is the center location (x,y). Next argument is axes lengths (major axis length, minor axis length). ``angle`` is the angle of rotation of ellipse in anti-clockwise direction. ``startAngle`` and ``endAngle`` denotes the starting and ending of ellipse arc measured in clockwise direction from major axis. i.e. giving values 0 and 360 gives the full ellipse. For more details, check the documentation of **cv2.ellipse()**. Below example draws a half ellipse at the center of the image.