Пример #1
0
    def __init__(self, max_object_distance=50, max_node_degree=3,
                 max_frame_gap=3):
        super(Tracker, self).__init__()

        if max_frame_gap < 1 or not isinstance(max_frame_gap, int):
            raise ValueError("max_frame_gap must be a positive integer")
        self.graph = Graph()
        self._frame_data = OrderedDict()

        self.max_frame_gap = max_frame_gap
        self.max_object_distance = max_object_distance
        self.max_node_degree = max_node_degree
Пример #2
0
    def clone_graph(self, timeholder, channel, region):
        """Clone the tracking graph with data from a different channel."""

        ngraph = Graph()

        # add nodes from other segmentation region
        for nodeid in self.graph.node_list():
            iframe, objid = Tracker.split_nodeid(nodeid)[:2]
            sample = timeholder[iframe][channel].get_region(region)[objid]
            ngraph.add_node(nodeid, sample)

        for edge in self.graph.edges.values():
            ngraph.add_edge(*edge)

        return ngraph