| 12345678910111213141516171819202122232425262728 |
- import cv2
- import matplotlib.pyplot as plt
- img = cv2.imread(r"C:\Code\ML\Project\CheckCardBoxAndDefectServer\_temp_work\temp_area_result.jpg")
- x1_min = 251
- y1_min = 273
- x1_max = 2636
- y1_max = 3662
- x2_min = 146
- y2_min = 177
- x2_max = 2735
- y2_max = 3767
- img = cv2.line(img, pt1=(x1_min, y1_min), pt2=(x1_min, y1_max), color=(0, 0, 255), thickness=4)
- img = cv2.line(img, pt1=(x1_min, y1_min), pt2=(x1_max, y1_min), color=(0, 0, 255), thickness=4)
- img = cv2.line(img, pt1=(x1_max, y1_max), pt2=(x1_min, y1_max), color=(0, 0, 255), thickness=4)
- img = cv2.line(img, pt1=(x1_max, y1_max), pt2=(x1_max, y1_min), color=(0, 0, 255), thickness=4)
- img = cv2.line(img, pt1=(x2_min, y2_min), pt2=(x2_min, y2_max), color=(0, 200, 255), thickness=4)
- img = cv2.line(img, pt1=(x2_min, y2_min), pt2=(x2_max, y2_min), color=(0, 200, 255), thickness=4)
- img = cv2.line(img, pt1=(x2_max, y2_max), pt2=(x2_min, y2_max), color=(0, 200, 255), thickness=4)
- img = cv2.line(img, pt1=(x2_max, y2_max), pt2=(x2_max, y2_min), color=(0, 200, 255), thickness=4)
- plt.imshow(img)
- plt.show()
|