Commit 327b9345 authored by jay's avatar jay
Browse files

Minor fixes for brownbag

parent 9e272396
Loading
Loading
Loading
Loading
+0 −1
Changes for autocnet/graph/edge.py: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -318,7 +318,6 @@ class Edge(dict, MutableMapping):
                                       'correlation', 'reference')] = [x_offset, y_offset, strength, source_image]
            except:
                warnings.warn('Template-Search size mismatch, failing for this correspondence point.')
                continue

        # Compute the mask for correlations less than the threshold
        threshold_mask = self.matches['correlation'] >= threshold
+0 −1
Changes for autocnet/graph/network.py: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -108,7 +108,6 @@ class CandidateGraph(nx.Graph):
        """
        if isinstance(filelist, str):
            filelist = io_utils.file_to_list(filelist)

        # TODO: Reject unsupported file formats + work with more file formats
        if basepath:
            datasets = [GeoDataset(os.path.join(basepath, f)) for f in filelist]
+7 −1
Changes for autocnet/matcher/subpixel.py: 7 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ def clip_roi(img, center, img_size):
    return clipped_img


def subpixel_offset(template, search, method='naive', **kwargs):
def subpixel_offset(template, search, **kwargs):
    """
    Uses a pattern-matcher on subsets of two images determined from the passed-in keypoints and optional sizes to
    compute an x and y offset from the search keypoint to the template keypoint and an associated strength.
@@ -76,6 +76,12 @@ def subpixel_offset(template, search, method='naive', **kwargs):
               Strength of the correspondence in the range [-1, 1]
    """

    if 'method' in kwargs.keys():
        method = kwargs['method']
        kwargs.pop('method', None)
    else:
        method = 'naive'

    functions = { 'naive' : naive_template.pattern_match,
                  'ciratefi' : ciratefi.ciratefi}

+12 −10
Changes for autocnet/vis/graph_view.py: 12 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ from matplotlib import pyplot as plt
import matplotlib


def plot_graph(graph, ax=None, cmap='Spectral', **kwargs):
def plot_graph(graph, ax=None, cmap='Spectral', labels=False, font_size=12, clusters=None, **kwargs):
    """

    Parameters
@@ -38,7 +38,13 @@ def plot_graph(graph, ax=None, cmap='Spectral', **kwargs):
        else:
            colors.append(cmap(0)[0])

    nx.draw(graph, ax=ax, edge_color=colors)
    pos = nx.spring_layout(graph)
    nx.draw_networkx_nodes(graph, pos)
    nx.draw_networkx_edges(graph, pos)
    if labels:
        labels = dict((i, d.image_name) for i, d in graph.nodes_iter(data=True))
        nx.draw_networkx_labels(graph, pos, labels, font_size=font_size)
    ax.axis('off')
    return ax


@@ -166,9 +172,9 @@ def plot_edge(edge, ax=None, clean_keys=[], image_space=100,
    composite[0: d_shape[0], s_shape[1] + image_space:] = destination_array

    if 'cmap' in image_kwargs:
        cmap = image_kwargs['cmap']
        image_cmap = image_kwargs['cmap']
    else:
        cmap = 'Greys'
        image_cmap = 'Greys'

    matches, mask = edge.clean(clean_keys)

@@ -178,7 +184,7 @@ def plot_edge(edge, ax=None, clean_keys=[], image_space=100,
    # Plot the source
    source_idx = matches['source_idx'].values
    s_kps = source_keypoints.loc[source_idx]
    ax.scatter(s_kps['x'], s_kps['y'], **scatter_kwargs, cmap='gray')
    ax.scatter(s_kps['x'], s_kps['y'], **scatter_kwargs)

    # Plot the destination
    destination_idx = matches['destination_idx'].values
@@ -187,7 +193,7 @@ 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)
    ax.imshow(composite, cmap=image_cmap)

    # Draw the connecting lines
    color = 'y'
@@ -203,7 +209,3 @@ def plot_edge(edge, ax=None, clean_keys=[], image_space=100,
        ax.plot((l[0][0], l[1][0]), (l[0][1], l[1][1]), color=color, **line_kwargs)

    return ax