Unverified Commit b720caf9 authored by Lauren Adoram-Kershner's avatar Lauren Adoram-Kershner Committed by GitHub
Browse files

Switching order of point registration (#432)



* switching order of point registration

* removing debugging print statements

Co-authored-by: default avatarLauren Adoram-Kershner <ladoramkershner@astrovm4.wr.usgs.gov>
parent f3abe2a1
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -486,29 +486,29 @@ def subpixel_register_point(pointid, iterative_phase_kwargs={}, subpixel_templat
        res = session.query(Images).filter(Images.id == destinationid).one()
        destination_node = NetworkNode(node_id=destinationid, image_path=res.path)

        new_phase_x, new_phase_y, phase_metrics = iterative_phase(source.sample,
        new_template_x, new_template_y, template_metric, _ = subpixel_template(source.sample,
                                                                source.line,
                                                                measure.sample,
                                                                measure.line,
                                                                source_node.geodata,
                                                                destination_node.geodata,
                                                                **iterative_phase_kwargs)
        if new_phase_x == None:
            measure.ignore = True # Unable to phase match
                                                                **subpixel_template_kwargs)
        if new_template_x == None:
            measure.ignore = True # Unable to template match
            continue

        new_template_x, new_template_y, template_metric, _ = subpixel_template(source.sample,
        new_phase_x, new_phase_y, phase_metrics = iterative_phase(source.sample,
                                                                source.line,
                                                                new_phase_x,
                                                                new_phase_y,
                                                                new_template_x,
                                                                new_template_y,
                                                                source_node.geodata,
                                                                destination_node.geodata,
                                                                **subpixel_template_kwargs)
        if new_template_x == None:
            measure.ignore = True # Unable to template match
                                                                **iterative_phase_kwargs)
        if new_phase_x == None:
            measure.ignore = True # Unable to phase match
            continue

        dist = np.linalg.norm([new_phase_x-new_template_x, new_phase_y-new_template_y])
        dist = np.linalg.norm([new_template_x-new_phase_x, new_template_y-new_phase_y])
        cost = cost_func(dist, template_metric)

        if cost <= threshold:
+3 −2
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ def main(msg, config):
    if overlap is None:
        print('Could not find overlap with ID', id)
        sys.exit(1)
    
    print('Placing points in overlap', oid)
    geom = overlap.geom
    nodes = []
    for id in overlap.intersections:
@@ -37,8 +39,7 @@ def main(msg, config):
        nodes.append(NetworkNode(node_id=id, image_path=res.path))
    session.close()

    print('Placing points in overlap', oid)
    points = place_points_in_overlap(nodes, geom, msg["cam_type"],
    points = place_points_in_overlap(nodes, geom, cam_type=msg["cam_type"],
                                     distribute_points_kwargs=msg['distribute_points_kwargs'])

    print('Adding {} points to the database.'.format(len(points)))