MCPcopy Create free account
hub / github.com/3DAnimals/3DAnimals / plot_points

Function plot_points

evaluation/evaluate.py:66–109  ·  view source on GitHub ↗
(points, image, visible=None, correct=None)

Source from the content-addressed store, hash-verified

64
65
66def plot_points(points, image, visible=None, correct=None):
67 colors = get_n_colors(len(points), pastel_factor=0.2)
68 if correct is None:
69 correct = [1] * len(points)
70 for i, (coord, color, visible_, correct_) in enumerate(
71 zip(points, colors, visible, correct)
72 ):
73 if visible_ == 1:
74 color = [255 * c for c in color]
75 if correct_:
76 image = cv2.circle(
77 np.ascontiguousarray(image),
78 tuple(coord.astype("int32")),
79 4,
80 color,
81 2,
82 )
83 else:
84 # plot x
85 image = cv2.line(
86 np.ascontiguousarray(image),
87 tuple(coord.astype("int32") - 4),
88 tuple(coord.astype("int32") + 4),
89 color,
90 2,
91 )
92 image = cv2.line(
93 np.ascontiguousarray(image),
94 tuple(coord.astype("int32") + np.array([-4, 4])),
95 tuple(coord.astype("int32") - np.array([-4, 4])),
96 color,
97 2,
98 )
99 # plot index next to point
100 image = cv2.putText(
101 np.ascontiguousarray(image),
102 str(i),
103 tuple(coord.astype("int32") + np.array([4, 4])),
104 cv2.FONT_HERSHEY_SIMPLEX,
105 0.5,
106 color,
107 1,
108 )
109 return image
110
111
112def visualize_vertices(verts, img, cmap="hot"):

Callers 1

visualizeFunction · 0.85

Calls 1

get_n_colorsFunction · 0.85

Tested by

no test coverage detected