# Path: util/visualize.py
# def check_point(cur_x, cur_y, minx, miny, maxx, maxy):
#     return minx < cur_x < maxx and miny < cur_y < maxy
# 
# def _npcircle(image, cx, cy, radius, color, transparency=0.0):
#     """Draw a circle on an image using only numpy methods."""
#     radius = int(radius)
#     cx = int(cx)
#     cy = int(cy)
#     y, x = np.ogrid[-radius: radius, -radius: radius]
#     index = x**2 + y**2 <= radius**2
#     image[cy-radius:cy+radius, cx-radius:cx+radius][index] = (
#         image[cy-radius:cy+radius, cx-radius:cx+radius][index].astype('float32') * transparency +
#         np.array(color).astype('float32') * (1.0 - transparency)).astype('uint8')
# 
# Path: util/visualize.py
# def _npcircle(image, cx, cy, radius, color, transparency=0.0):
# def check_point(cur_x, cur_y, minx, miny, maxx, maxy):
# def visualize_joints(image, pose):
# def show_heatmaps(cfg, img, scmap, pose, cmap="jet"):
# def show_arrows(cfg, img, pose, arrows):
# def waitforbuttonpress():


import math
import numpy as np
import scipy.spatial
import matplotlib.pyplot as plt
import munkres
from util.visualize import check_point, _npcircle
from util import visualize
                if cost_matrix[pidx1][pidx2] < min_match_dist:
                    color_assignment[pidx1] = self.prev_color_assignment[pidx2]

        print("#tracked objects:", len(color_assignment))

        free_coloridx = sorted(list(set(range(len(self.track_colors))).difference(set(color_assignment.values()))),
                               reverse=True)

        for pidx in range(num_people):
            # color_idx = pidx % len(self.track_colors)
            if pidx in color_assignment:
                color_idx = color_assignment[pidx]
            else:
                if len(free_coloridx) > 0:
                    color_idx = free_coloridx[-1]
                    free_coloridx = free_coloridx[:-1]
                else:
                    color_idx = np.random.randint(len(self.track_colors))

                color_assignment[pidx] = color_idx

            assert (color_idx < len(self.track_colors))

            if np.sum(person_conf[pidx, :, 0] > 0) < draw_conf_min_count:
                continue

            for kidx1, kidx2 in dataset.get_pose_segments():
                p1 = (int(math.floor(person_conf[pidx, kidx1, 0])), int(math.floor(person_conf[pidx, kidx1, 1])))
                p2 = (int(math.floor(person_conf[pidx, kidx2, 0])), int(math.floor(person_conf[pidx, kidx2, 1])))


# Path: util/visualize.py
# def check_point(cur_x, cur_y, minx, miny, maxx, maxy):
#     return minx < cur_x < maxx and miny < cur_y < maxy
# 
# def _npcircle(image, cx, cy, radius, color, transparency=0.0):
#     """Draw a circle on an image using only numpy methods."""
#     radius = int(radius)
#     cx = int(cx)
#     cy = int(cy)
#     y, x = np.ogrid[-radius: radius, -radius: radius]
#     index = x**2 + y**2 <= radius**2
#     image[cy-radius:cy+radius, cx-radius:cx+radius][index] = (
#         image[cy-radius:cy+radius, cx-radius:cx+radius][index].astype('float32') * transparency +
#         np.array(color).astype('float32') * (1.0 - transparency)).astype('uint8')
# 
# Path: util/visualize.py
# def _npcircle(image, cx, cy, radius, color, transparency=0.0):
# def check_point(cur_x, cur_y, minx, miny, maxx, maxy):
# def visualize_joints(image, pose):
# def show_heatmaps(cfg, img, scmap, pose, cmap="jet"):
# def show_arrows(cfg, img, pose, arrows):
# def waitforbuttonpress():


# Path: multiperson/visualize.py
import math
import numpy as np
import scipy.spatial
import matplotlib.pyplot as plt
import munkres
from util.visualize import check_point, _npcircle
from util import visualize

                if cost_matrix[pidx1][pidx2] < min_match_dist:
                    color_assignment[pidx1] = self.prev_color_assignment[pidx2]

        print("#tracked objects:", len(color_assignment))

        free_coloridx = sorted(list(set(range(len(self.track_colors))).difference(set(color_assignment.values()))),
                               reverse=True)

        for pidx in range(num_people):
            # color_idx = pidx % len(self.track_colors)
            if pidx in color_assignment:
                color_idx = color_assignment[pidx]
            else:
                if len(free_coloridx) > 0:
                    color_idx = free_coloridx[-1]
                    free_coloridx = free_coloridx[:-1]
                else:
                    color_idx = np.random.randint(len(self.track_colors))

                color_assignment[pidx] = color_idx

            assert (color_idx < len(self.track_colors))

            if np.sum(person_conf[pidx, :, 0] > 0) < draw_conf_min_count:
                continue

            for kidx1, kidx2 in dataset.get_pose_segments():
                p1 = (int(math.floor(person_conf[pidx, kidx1, 0])), int(math.floor(person_conf[pidx, kidx1, 1])))
                p2 = (int(math.floor(person_conf[pidx, kidx2, 0])), int(math.floor(person_conf[pidx, kidx2, 1])))


                if check_point(p1[0], p1[1], minx, miny, maxx, maxy) and check_point(p2[0], p2[1], minx, miny, maxx,