Commit d4caeecb authored by Bauck, Kirsten (Contractor) Hailey's avatar Bauck, Kirsten (Contractor) Hailey
Browse files

Merge branch 'Fix_palce_points' into 'main'

Update code to work with place_points_centroids

See merge request astrogeology/autocnet!689
parents fc13d4a0 14b3ae90
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -33,6 +33,9 @@ heading to indicate that only the bug fixes and security fixes are in the bug fi
release.
-->
## [Unreleased]
### Fixed
- Errors when importing sensor model in `overlap.py`
- Dealt with None values trying to be converted to a shapely point in `centroids.py`

## [1.1.0]
### Added
+11 −3
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ from autocnet.cg.cg import create_points_along_line
from autocnet.io.db.model import Images, Points, JsonEncoder
from autocnet.graph.node import NetworkNode
from autocnet.spatial import isis
from autocnet.spatial import sensor
from autocnet.transformation import roi
from autocnet.matcher.cpu_extractor import extract_most_interesting
from autocnet.matcher.validation import is_valid_lroc_polar_image
@@ -178,13 +179,17 @@ def find_intresting_point(nodes, lon, lat, size=71):
        log.debug(f'Trying image: {node["image_path"].split("/")[-1]}')
        # reference_index is the index into the list of measures for the image that is not shifted and is set at the
        # reference against which all other images are registered.
        sample, line = isis.ground_to_image(node["image_path"], lon, lat)
        try_sample, try_line = isis.ground_to_image(node["image_path"], lon, lat)

        # If sample/line are None, point is not in image
        if sample == None or line == None:
        if try_sample == None or try_line == None:
            log.info(f'point ({lon}, {lat}) does not project to reference image {node["image_path"]}')
            continue

        # This a prevention in case the last sample/line are NULL when itterating
        sample = try_sample
        line = try_line

        # Extract ORB features in a sub-image around the desired point
        image_roi = roi.Roi(node.geodata, sample, line, size_x=size, size_y=size)
        try:
@@ -346,8 +351,11 @@ def add_point_to_network(valid,
    # It has been added by the create_point_with_reference_measure function.
    del nodes[reference_index]

    # Determine what sensor type to use
    current_sensor = sensor.create_sensor('isis')

    # Iterate through all other, non-reference images in the overlap and attempt to add a measure.
    point.add_measures_to_point(nodes, choosername=identifier)
    point.add_measures_to_point(nodes, current_sensor, choosername=identifier)

    # Insert the point into the database asynchronously (via redis) or synchronously via the ncg
    if use_cache:
+6 −6
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ def place_points_in_overlap(overlap,
        raise BrokenPipeError('This func requires a database session from a NetworkCandidateGraph.')
    
    # Determine what sensor type to use
    sensor = sensor.create_sensor(cam_type)
    current_sensor = sensor.create_sensor(cam_type)

    # Determine the point distribution in the overlap geom
    geom = overlap.geom
@@ -240,7 +240,7 @@ def place_points_in_overlap(overlap,
    for valid in candidate_points:
        add_point_to_overlap_network(valid,
                                    nodes,
                                    sensor,
                                    current_sensor,
                                    geom,
                                    identifier=identifier,
                                    interesting_func=interesting_func,
@@ -254,7 +254,7 @@ def place_points_in_overlap(overlap,

def add_point_to_overlap_network(valid,
                                nodes,
                                sensor,
                                current_sensor,
                                geom,
                                identifier="place_points_in_overlap",
                                interesting_func=find_interesting_point,
@@ -275,8 +275,8 @@ def add_point_to_overlap_network(valid,
    nodes: list
        list of node objects (the images)
    
    sensor: string
        sensor that is being used, either isis or csm
    current_sensor: string
        current_sensor that is being used, either isis or csm

    geom: obj
        overlap geom to be used
@@ -358,7 +358,7 @@ def add_point_to_overlap_network(valid,
    # TODO: Take this projection out of the CSM model and work it into the point
    kwargs['needs_projection']=False
    # Iterate through all other, non-reference images in the overlap and attempt to add a measure.
    point.add_measures_to_point(nodes, sensor, choosername=identifier, **csm_kwargs)
    point.add_measures_to_point(nodes, current_sensor, choosername=identifier, **csm_kwargs)

    # Insert the point into the database asynchronously (via redis) or synchronously via the ncg
    if use_cache: