]>
Commit | Line | Data |
---|---|---|
e99251ce | 1 | import cv2 |
2 | ||
3 | def drawBox(image, points, color, thickness): | |
4 | last_point = points[3] | |
5 | for point in points: | |
6 | cv2.line(image, last_point, point, color, thickness) | |
7 | last_point = point | |
8 | ||
9 | def drawDots(image, points, size, color, thickness): | |
10 | for point in points: | |
11 | cv2.circle(image, point, size, color, thickness) | |
12 | #Mark TopLeft corner with white dot | |
13 | cv2.circle(image,points[0], 2, (255,255,255),-1) | |
14 | ||
dcd7df75 MR |
15 | def drawImage(frame, printer): |
16 | drawBox(frame, printer.settings.laser_frame.corners, (255, 255, 255), 1) | |
17 | drawDots(frame, printer.settings.laser_frame.corners, 10, (255, 0, 0), -1) | |
18 | x,y = printer.settings.laser_frame.getCenter() | |
19 | cv2.circle(frame, (int(x), int(y)), 4, (0, 255, 0), 1) | |
5e014f1f | 20 | cx,cy = printer.position |
e99251ce | 21 | cv2.putText(frame, str((round(cx),round(cy))), (20, 450), cv2.FONT_HERSHEY_COMPLEX, 0.5, (255, 255, 255)) |
01d5acb3 | 22 | if printer.sendSpike: |
5e014f1f MR |
23 | cv2.circle(frame, (150, 450), 10, (0, 255, 0), 25) |
24 | else: | |
25 | cv2.circle(frame, (150, 450), 10, (0, 0, 255), 25) | |
26 |