# Creating Shapes on Images
# Line
#cv2.line(imageObjectName, (‘start_coordinates’), (‘end_coordinates’), (‘color_in_bgr’), ‘line_thickness’)
try:
cv2.line(processed_img, (0, 10), (30, 20), [255,0,0], 3)
except Exception as e:
print(str(e))
1
2
3
4
5
2
3
4
5
# Rectangle
#cv2.rectangle(img, (‘top_left_cord’), (‘lower_right_cord’), (‘stroke_color_in_bgr’), ‘stroke_thick’)
cv2.rectangle(img, (30, 30), (300, 200), (0, 255, 0), 5)
1
2
2
# Circle
#cv2.circle(img, (‘center_cord’), (‘circle_radius’), (‘color_in_bgr’), ‘stroke_thickness’)
cv2.circle(img, (200, 200), 80, (255, 0, 0), 3)
1
2
2
# Writing text
#cv2.putText(img, ‘Text’, (‘start_point_cord’), ‘fontToBeUsed’, ‘font_size’, (‘text_color’, ‘text_thickness’, ‘line_type’)
font = cv2.FONT_HERSHEY_SIMPLEX
cv2.putText(img, 'Santosh Dahal', (50, 50), font, 0.8, (0, 255, 0), 2, cv2.LINE_AA)
1
2
3
2
3