cv2 draw box code example
Example 1: python opencv draw rectangle
image = cv2.imread(path)
start_point = (5, 5)
end_point = (220, 220)
color = (255, 0, 0)
thickness = 2
image = cv2.rectangle(image, start_point, end_point, color, thickness)
Example 2: cv2 draw box
import cv2
path = r'C:\Users\Rajnish\Desktop\geeksforgeeks\geeks.png'
image = cv2.imread(path, 0)
start_point = (100, 50)
end_point = (125, 80)
color = (0, 0, 0)
linethickness = -1
image = cv2.rectangle(image, start_point, end_point, color, linethickness)
cv2.imshow('Image', image)