MCPcopy Create free account
hub / github.com/aim-uofa/Framer / draw_heatmap

Function draw_heatmap

models_diffusers/utils.py:35–50  ·  view source on GitHub ↗
(img, center_coordinate, heatmap_template, side, width, height)

Source from the content-addressed store, hash-verified

33
34
35def draw_heatmap(img, center_coordinate, heatmap_template, side, width, height):
36 x1 = max(center_coordinate[0] - side, 1)
37 x2 = min(center_coordinate[0] + side, width - 1)
38 y1 = max(center_coordinate[1] - side, 1)
39 y2 = min(center_coordinate[1] + side, height - 1)
40 x1, x2, y1, y2 = int(x1), int(x2), int(y1), int(y2)
41
42 if (x2 - x1) < 1 or (y2 - y1) < 1:
43 print(center_coordinate, "x1, x2, y1, y2", x1, x2, y1, y2)
44 return img
45
46 need_map = cv2.resize(heatmap_template, (x2-x1, y2-y1))
47
48 img[y1:y2,x1:x2] = need_map
49
50 return img
51
52
53def generate_gassian_heatmap(pred_tracks, pred_visibility=None, image_size=None, side=20):

Callers 1

generate_gassian_heatmapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected