We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 03fe25a commit 822f5d4Copy full SHA for 822f5d4
dlclive/display.py
@@ -95,26 +95,10 @@ def display_frame(self, frame, pose=None):
95
for j in range(pose.shape[1]):
96
if pose[i, j, 2] > self.pcutoff:
97
try:
98
- x0 = (
99
- pose[i, j, 0] - self.radius
100
- if pose[i, j, 0] - self.radius > 0
101
- else 0
102
- )
103
- x1 = (
104
- pose[i, j, 0] + self.radius
105
- if pose[i, j, 0] + self.radius < im_size[0]
106
- else im_size[0]
107
108
- y0 = (
109
- pose[i, j, 1] - self.radius
110
- if pose[i, j, 1] - self.radius > 0
111
112
113
- y1 = (
114
- pose[i, j, 1] + self.radius
115
- if pose[i, j, 1] + self.radius < im_size[1]
116
- else im_size[1]
117
+ x0 = max(0, pose[i, j, 0] - self.radius)
+ x1 = min(im_size[0], pose[i, j, 0] + self.radius)
+ y0 = max(0, pose[i, j, 1] - self.radius)
+ y1 = min(im_size[1], pose[i, j, 1] + self.radius)
118
coords = [x0, y0, x1, y1]
119
draw.ellipse(
120
coords, fill=self.colors[j], outline=self.colors[j]
0 commit comments