Loading CHANGELOG.md +7 −0 Original line number Diff line number Diff line Loading @@ -33,10 +33,17 @@ heading to indicate that only the bug fixes and security fixes are in the bug fi release. --> ## [Unreleased] ### Added - Ability to choose whether to compute overlaps for a network candidate graph ### Fixed - Errors when importing sensor model in `overlap.py` - Dealt with None values trying to be converted to a shapely point in `centroids.py` - Dealt with Key Error when finding file paths in the network nodes. - Removed depreciated function from `spatial.py` and replaced - Fixed Errors in `network.py` - Finding points in polar areas that avoids dividing by zero errors - Small errors in `overlap.py` to get overlap function working. ## [1.1.0] ### Added Loading autocnet/graph/network.py +3 −2 Original line number Diff line number Diff line Loading @@ -2405,7 +2405,7 @@ class NetworkCandidateGraph(CandidateGraph): else: continue def add_from_remote_database(self, source_db_config, path=None, query_string=sql.select_ten_pub_image): def add_from_remote_database(self, source_db_config, path=None, query_string=sql.select_ten_pub_image, overlaps=True): """ This is a constructor that takes an existing database containing images and sensors, copies the selected rows into the project specified in the autocnet_config variable, Loading Loading @@ -2476,6 +2476,7 @@ class NetworkCandidateGraph(CandidateGraph): if path: self.copy_images(path) self.from_database() if overlaps: self._execute_sql(sql.compute_overlaps_sql) def from_database(self, query_string=sql.select_pub_image): Loading autocnet/spatial/centroids.py +10 −4 Original line number Diff line number Diff line Loading @@ -83,7 +83,8 @@ def find_points_in_centroids(radius, min_lat=None, max_lat=None, longitude_min=-180, longitude_max=180): longitude_max=180, latitude_decriment=-0.005): """ This finds points within a specified geometry. It finds those points be placing points in a centroid pattern Loading Loading @@ -124,11 +125,13 @@ def find_points_in_centroids(radius, # Set up processes if polygon: _, min_lat, _, max_lat = polygon.bounds latitude_intervals = np.arange(max_lat, min_lat, -0.005) latitude_intervals = np.arange(max_lat, min_lat, latitude_decriment) # Remove intervals that cause divide by 0 errors latitude_intervals = latitude_intervals[latitude_intervals != 270.0] latitude_intervals = latitude_intervals[latitude_intervals != 90.0] points=[] # Itterate through each latitude, decrimenting at -0.005 # TODO: decide if this decrement should be a user input # Itterate through each latitude for lat in latitude_intervals: # Calculate the number of points needed to space points along a latitude line every __km num_points = get_number_of_points(target_distance_in_km, lat, radius) Loading Loading @@ -338,6 +341,9 @@ def add_point_to_network(valid, reference_node = nodes[reference_index] x,y,z = isis.linesamp2xyz(reference_node['image_path'], interesting_sampline.x, interesting_sampline.y) if x == None or y==None or z==None: log.info("Updated point projects outside of image, ignoring") return # Create the point object for insertion into the database point_geom = shapely.geometry.Point(x, y, z) point = Points.create_point_with_reference_measure(point_geom, Loading autocnet/spatial/overlap.py +18 −7 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ def place_points_in_overlaps(size_threshold=0.0007, point_type=point_type, ncg=ncg) def find_interesting_point(nodes, lon, lat, sensor, size=71, **kwargs): def find_interesting_point(nodes, lon, lat, current_sensor, size=71, **kwargs): """ Find an interesting point close the given lon, lat given a list data structure that contains the image_path and the geodata for the image. Loading Loading @@ -100,18 +100,25 @@ def find_interesting_point(nodes, lon, lat, sensor, size=71, **kwargs): The intresting point close to the given lat/lon """ if not nodes: log.info("Tried to itterate through a node that does not exist, skipping") return None, None # Itterate through the images to find an interesting point for reference_index, node in enumerate(nodes): 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 = sensor.calculate_sample_line(node, lon, lat, **kwargs) 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: Loading @@ -121,7 +128,7 @@ def find_interesting_point(nodes, lon, lat, sensor, size=71, **kwargs): continue # Check if the image is valid and could be used as the reference if not is_valid_lroc_image(roi_array, include_var=True, include_mean=False, include_std=False): if not is_valid_lroc_image(roi_array): log.info('Failed to find interesting features in image due to poor quality image.') continue Loading Loading @@ -221,7 +228,7 @@ def place_points_in_overlap(overlap, # Determine the point distribution in the overlap geom geom = overlap.geom candidate_points = compgeom.distribute_points_in_geom(geom, ratio_size=ratio_size, **distribute_points_kwargs, **kwargs) if not valid.any(): if not candidate_points.any(): warnings.warn(f'Failed to distribute points in overlap {overlap.id}') return [] Loading Loading @@ -323,14 +330,18 @@ def add_point_to_overlap_network(valid, } # Find the intresting sampleline and what image it is in reference_index, interesting_sampline = interesting_func(nodes, lon, lat, sensor, size=interesting_func_kwargs['size'], **csm_kwargs) reference_index, interesting_sampline = interesting_func(nodes, lon, lat, current_sensor, size=interesting_func_kwargs['size'], **csm_kwargs) if not interesting_sampline: return log.info(f'Found an interesting feature in {nodes[reference_index]["image_path"]} at {interesting_sampline.x}, {interesting_sampline.y}.') # Get the updated X,Y,Z location of the point and reproject to get the updates lon, lat. # The io.db.Point class handles all xyz to lat/lon and ographic/ocentric conversions in it's # adjusted property setter. reference_node = nodes[reference_index] x,y,z = sensor.linesamp2xyz(reference_node, interesting_sampline.x, interesting_sampline.y, **csm_kwargs) x,y,z = current_sensor.linesamp2xyz(reference_node, interesting_sampline.x, interesting_sampline.y, **csm_kwargs) # If the updated point is outside of the overlap, then revert back to the # original point and hope the matcher can handle it when sub-pixel registering Loading autocnet/spatial/sensor.py +2 −2 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ class ISISSensor: sample, line = isis.ground_to_image(node["image_path"], lon, lat) return sample, line def linesamp2xyz(node, sample, line, **kwargs): def linesamp2xyz(self, node, sample, line, **kwargs): """ Convert a line and sample into and x,y,z point for isis camera model Loading Loading @@ -132,7 +132,7 @@ class CSMSensor: sample, line = image_coord.samp, image_coord.line return sample,line def linesamp2xyz(node, sample, line, **kwargs): def linesamp2xyz(self, node, sample, line, **kwargs): """ Convert a line and sample into and x,y,z point for csm camera model Loading Loading
CHANGELOG.md +7 −0 Original line number Diff line number Diff line Loading @@ -33,10 +33,17 @@ heading to indicate that only the bug fixes and security fixes are in the bug fi release. --> ## [Unreleased] ### Added - Ability to choose whether to compute overlaps for a network candidate graph ### Fixed - Errors when importing sensor model in `overlap.py` - Dealt with None values trying to be converted to a shapely point in `centroids.py` - Dealt with Key Error when finding file paths in the network nodes. - Removed depreciated function from `spatial.py` and replaced - Fixed Errors in `network.py` - Finding points in polar areas that avoids dividing by zero errors - Small errors in `overlap.py` to get overlap function working. ## [1.1.0] ### Added Loading
autocnet/graph/network.py +3 −2 Original line number Diff line number Diff line Loading @@ -2405,7 +2405,7 @@ class NetworkCandidateGraph(CandidateGraph): else: continue def add_from_remote_database(self, source_db_config, path=None, query_string=sql.select_ten_pub_image): def add_from_remote_database(self, source_db_config, path=None, query_string=sql.select_ten_pub_image, overlaps=True): """ This is a constructor that takes an existing database containing images and sensors, copies the selected rows into the project specified in the autocnet_config variable, Loading Loading @@ -2476,6 +2476,7 @@ class NetworkCandidateGraph(CandidateGraph): if path: self.copy_images(path) self.from_database() if overlaps: self._execute_sql(sql.compute_overlaps_sql) def from_database(self, query_string=sql.select_pub_image): Loading
autocnet/spatial/centroids.py +10 −4 Original line number Diff line number Diff line Loading @@ -83,7 +83,8 @@ def find_points_in_centroids(radius, min_lat=None, max_lat=None, longitude_min=-180, longitude_max=180): longitude_max=180, latitude_decriment=-0.005): """ This finds points within a specified geometry. It finds those points be placing points in a centroid pattern Loading Loading @@ -124,11 +125,13 @@ def find_points_in_centroids(radius, # Set up processes if polygon: _, min_lat, _, max_lat = polygon.bounds latitude_intervals = np.arange(max_lat, min_lat, -0.005) latitude_intervals = np.arange(max_lat, min_lat, latitude_decriment) # Remove intervals that cause divide by 0 errors latitude_intervals = latitude_intervals[latitude_intervals != 270.0] latitude_intervals = latitude_intervals[latitude_intervals != 90.0] points=[] # Itterate through each latitude, decrimenting at -0.005 # TODO: decide if this decrement should be a user input # Itterate through each latitude for lat in latitude_intervals: # Calculate the number of points needed to space points along a latitude line every __km num_points = get_number_of_points(target_distance_in_km, lat, radius) Loading Loading @@ -338,6 +341,9 @@ def add_point_to_network(valid, reference_node = nodes[reference_index] x,y,z = isis.linesamp2xyz(reference_node['image_path'], interesting_sampline.x, interesting_sampline.y) if x == None or y==None or z==None: log.info("Updated point projects outside of image, ignoring") return # Create the point object for insertion into the database point_geom = shapely.geometry.Point(x, y, z) point = Points.create_point_with_reference_measure(point_geom, Loading
autocnet/spatial/overlap.py +18 −7 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ def place_points_in_overlaps(size_threshold=0.0007, point_type=point_type, ncg=ncg) def find_interesting_point(nodes, lon, lat, sensor, size=71, **kwargs): def find_interesting_point(nodes, lon, lat, current_sensor, size=71, **kwargs): """ Find an interesting point close the given lon, lat given a list data structure that contains the image_path and the geodata for the image. Loading Loading @@ -100,18 +100,25 @@ def find_interesting_point(nodes, lon, lat, sensor, size=71, **kwargs): The intresting point close to the given lat/lon """ if not nodes: log.info("Tried to itterate through a node that does not exist, skipping") return None, None # Itterate through the images to find an interesting point for reference_index, node in enumerate(nodes): 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 = sensor.calculate_sample_line(node, lon, lat, **kwargs) 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: Loading @@ -121,7 +128,7 @@ def find_interesting_point(nodes, lon, lat, sensor, size=71, **kwargs): continue # Check if the image is valid and could be used as the reference if not is_valid_lroc_image(roi_array, include_var=True, include_mean=False, include_std=False): if not is_valid_lroc_image(roi_array): log.info('Failed to find interesting features in image due to poor quality image.') continue Loading Loading @@ -221,7 +228,7 @@ def place_points_in_overlap(overlap, # Determine the point distribution in the overlap geom geom = overlap.geom candidate_points = compgeom.distribute_points_in_geom(geom, ratio_size=ratio_size, **distribute_points_kwargs, **kwargs) if not valid.any(): if not candidate_points.any(): warnings.warn(f'Failed to distribute points in overlap {overlap.id}') return [] Loading Loading @@ -323,14 +330,18 @@ def add_point_to_overlap_network(valid, } # Find the intresting sampleline and what image it is in reference_index, interesting_sampline = interesting_func(nodes, lon, lat, sensor, size=interesting_func_kwargs['size'], **csm_kwargs) reference_index, interesting_sampline = interesting_func(nodes, lon, lat, current_sensor, size=interesting_func_kwargs['size'], **csm_kwargs) if not interesting_sampline: return log.info(f'Found an interesting feature in {nodes[reference_index]["image_path"]} at {interesting_sampline.x}, {interesting_sampline.y}.') # Get the updated X,Y,Z location of the point and reproject to get the updates lon, lat. # The io.db.Point class handles all xyz to lat/lon and ographic/ocentric conversions in it's # adjusted property setter. reference_node = nodes[reference_index] x,y,z = sensor.linesamp2xyz(reference_node, interesting_sampline.x, interesting_sampline.y, **csm_kwargs) x,y,z = current_sensor.linesamp2xyz(reference_node, interesting_sampline.x, interesting_sampline.y, **csm_kwargs) # If the updated point is outside of the overlap, then revert back to the # original point and hope the matcher can handle it when sub-pixel registering Loading
autocnet/spatial/sensor.py +2 −2 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ class ISISSensor: sample, line = isis.ground_to_image(node["image_path"], lon, lat) return sample, line def linesamp2xyz(node, sample, line, **kwargs): def linesamp2xyz(self, node, sample, line, **kwargs): """ Convert a line and sample into and x,y,z point for isis camera model Loading Loading @@ -132,7 +132,7 @@ class CSMSensor: sample, line = image_coord.samp, image_coord.line return sample,line def linesamp2xyz(node, sample, line, **kwargs): def linesamp2xyz(self, node, sample, line, **kwargs): """ Convert a line and sample into and x,y,z point for csm camera model Loading