def make_heatmap(emptymap, joint_idx, point, sigma):
    (point_x, point_y) = point
    (_, height, width) = emptymap.shape[:3]
    th = 4.605
    delta = math.sqrt((th * 2))
    x0 = int(max(0, (point_x - (delta * sigma))))
    y0 = int(max(0, (point_y - (delta * sigma))))
    x1 = int(min(width, (point_x + (delta * sigma))))
    y1 = int(min(height, (point_y + (delta * sigma))))
    for y in range(y0, y1):
        for x in range(x0, x1):
            d = (((x - point_x) ** 2) + ((y - point_y) ** 2))
            exp = (((d / 2.0) / sigma) / sigma)
            if (exp > th):
                continue
            emptymap[joint_idx][y][x] = max(emptymap[joint_idx][y][x], math.exp((- exp)))
            emptymap[joint_idx][y][x] = min(emptymap[joint_idx][y][x], 1.0)
def make_heatmap(emptymap, joint_idx, point, sigma):
    (point_x, point_y) = point
    (_, height, width) = emptymap.shape[:3]
    th = 4.605
    delta = math.sqrt((th * 2))
    x0 = int(max(0, (point_x - (delta * sigma))))
    y0 = int(max(0, (point_y - (delta * sigma))))
    x1 = int(min(width, (point_x + (delta * sigma))))
    y1 = int(min(height, (point_y + (delta * sigma))))
    for y in range(y0, y1):
        for x in range(x0, x1):
            d = (((x - point_x) ** 2) + ((y - point_y) ** 2))
            exp = (((d / 2.0) / sigma) / sigma)
            if (exp > th):
                continue
            emptymap[joint_idx][y][x] = max(emptymap[joint_idx][y][x], math.exp((- exp)))
            emptymap[joint_idx][y][x] = min(emptymap[joint_idx][y][x], 1.0)