1import cv2
2
3cv2.rectangle(img, (x1, y1), (x2, y2), (255,0,0), 2)
4
5
6x1,y1 ------
7| |
8| |
9| |
10--------x2,y2
11
1image = cv2.imread(path)
2
3start_point = (5, 5)
4end_point = (220, 220)
5
6# Blue color in BGR
7color = (255, 0, 0)
8
9# Line thickness of 2 px
10thickness = 2
11
12# Using cv2.rectangle() method
13# Draw a rectangle with blue line borders of thickness of 2 px
14image = cv2.rectangle(image, start_point, end_point, color, thickness)