Commit b906e6f2 authored by Kelvin's avatar Kelvin
Browse files

added source/dest plotting to Edge

parent 127d9ffa
Loading
Loading
Loading
Loading
+11 −0
Changes for autocnet/graph/edge.py: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ from autocnet.matcher import subpixel as sp
from autocnet.matcher.feature import FlannMatcher
from autocnet.transformation.transformations import FundamentalMatrix, Homography
from autocnet.vis.graph_view import plot_edge
from autocnet.vis.graph_view import plot_node
from autocnet.cg import cg


@@ -379,6 +380,16 @@ class Edge(dict, MutableMapping):
        mask[mask] = self.suppression.mask
        self.masks = ('suppression', mask)

    def plot_source(self, ax=None, clean_keys=[], **kwargs):
        matches, mask = self.clean(clean_keys=clean_keys)
        indices = pd.Index(matches['source_idx'].values)
        return plot_node(self.source, ax=ax, index_mask=indices, **kwargs)

    def plot_destination(self, ax=None, clean_keys=[], **kwargs):
        matches, mask = self.clean(clean_keys=clean_keys)
        indices = pd.Index(matches['destination_idx'].values)
        return plot_node(self.destination, ax=ax, index_mask=indices, **kwargs)

    def plot(self, ax=None, clean_keys=[], **kwargs):
        return plot_edge(self, ax=ax, clean_keys=clean_keys, **kwargs)

+8 −7
Changes for autocnet/vis/graph_view.py: 8 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ def plot_graph(graph, ax=None, cmap='Spectral', **kwargs):
    return ax


def plot_node(node, ax=None, clean_keys=[], **kwargs):
def plot_node(node, ax=None, clean_keys=[], index_mask = None, **kwargs):
    """
    Plot the array and keypoints for a given node.

@@ -88,10 +88,11 @@ def plot_node(node, ax=None, clean_keys=[], **kwargs):

    ax.imshow(array, cmap=cmap)

    keypoints = node.get_keypoints()
    if clean_keys:
        matches, mask = node.clean(clean_keys)
        keypoints = node.get_keypoints()[mask]
    keypoints = node.get_keypoints(index=index_mask)
    # Node has no clean function called cleangit p
    # if clean_keys:
    #     matches, mask = node.clean(clean_keys)
    #     keypoints = keypoints[mask]

    marker = '.'
    if 'marker' in kwargs.keys():
@@ -169,8 +170,6 @@ def plot_edge(edge, ax=None, clean_keys=[], image_space=100,
    else:
        cmap = 'Greys'

    ax.imshow(composite, cmap=cmap)

    matches, mask = edge.clean(clean_keys)

    source_keypoints = edge.source.get_keypoints(index=matches['source_idx'])
@@ -188,6 +187,8 @@ def plot_edge(edge, ax=None, clean_keys=[], image_space=100,
    newx = d_kps['x'] + x_offset
    ax.scatter(newx, d_kps['y'], **scatter_kwargs)

    ax.imshow(composite, cmap=cmap)

    # Draw the connecting lines
    color = 'y'
    if 'color' in line_kwargs.keys():
+488 −0

File added.

Preview size limit exceeded, changes collapsed.

+86 −12

File changed.

Preview size limit exceeded, changes collapsed.