Loading autocnet/matcher/subpixel.py +5 −5 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ from autocnet.spatial import isis from autocnet.io.db.model import Measures, Points, Images, JsonEncoder from autocnet.graph.node import NetworkNode from autocnet.transformation import roi from autocnet.transformation.affine import estimate_affine_transformation from autocnet.transformation.affine import estimate_affine_from_sensors from autocnet import spatial from autocnet.utils.utils import bytescale Loading Loading @@ -846,7 +846,7 @@ def geom_match_simple(reference_image, match_func = check_match_func(match_func) # Estimate the transformation between the two images affine = estimate_affine_transformation(reference_image, moving_image, bcenter_x, bcenter_y) affine = estimate_affine_from_sensors(reference_image, moving_image, bcenter_x, bcenter_y) t2 = time.time() print(f'Estimation of the transformation took {t2-t1} seconds.') Loading Loading @@ -1230,7 +1230,7 @@ def geom_match(destination_cube, # Estimate the transformation affine = estimate_affine_transformation(destination_corners, source_corners) affine = estimate_affine_from_sensors(destination_corners, source_corners) # Apply the subpixel matcher with an affine transformation restemplate = subpixel_transformed_template(bcenter_x, bcenter_y, Loading Loading @@ -2083,7 +2083,7 @@ def subpixel_register_point_smart(pointid, print('geom_func', geom_func) try: affine = estimate_affine_transformation(source_node.geodata, affine = estimate_affine_from_sensors(source_node.geodata, destination_node.geodata, source.apriorisample, source.aprioriline) Loading Loading @@ -2394,7 +2394,7 @@ def validate_candidate_measure(measure_to_register, print(f'Validating measure: {measure_to_register_id} on image: {source_image.name}') try: affine = estimate_affine_transformation(source_node.geodata, destination_node.geodata, sample, line) affine = estimate_affine_from_sensors(source_node.geodata, destination_node.geodata, sample, line) except: print('Unable to transform image to reference space. Likely too close to the edge of the non-reference image. Setting ignore=True') return [np.inf] * len(parameters) Loading autocnet/transformation/affine.py +7 −7 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ from autocnet.spatial import isis log = logging.getLogger(__name__) def estimate_affine_transformation(reference_image, def estimate_affine_from_sensors(reference_image, moving_image, bcenter_x, bcenter_y, Loading Loading @@ -85,5 +85,5 @@ def estimate_affine_transformation(reference_image, affine = tf.estimate_transform('affine', np.array([*base_gcps]), np.array([*dst_gcps])) t2 = time.time() print(f'Estimation of the transformation took {t2-t1} seconds.') log.debug(f'Estimation of the transformation took {t2-t1} seconds.') return affine No newline at end of file autocnet/transformation/tests/test_affine.py +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ from autocnet.transformation import affine def test_estimate_affine_transformation(): gd_base = GeoDataset('tests/test_subpixel_match/B08_012650_1780_XN_02S046W.l1.cal.destriped.crop.cub') gd_match = GeoDataset('tests/test_subpixel_match/J04_046447_1777_XI_02S046W.l1.cal.destriped.crop.cub') affine_transform = affine.estimate_affine_transformation(gd_base,gd_match, 150, 150) affine_transform = affine.estimate_affine_from_sensors(gd_base, gd_match, 150, 150) assert affine_transform.rotation == pytest.approx(-0.0012609633370663982, 6) assert affine_transform.shear == pytest.approx(0.01262411827876344) assert affine_transform.scale[0] == pytest.approx(1.0, 6) Loading Loading
autocnet/matcher/subpixel.py +5 −5 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ from autocnet.spatial import isis from autocnet.io.db.model import Measures, Points, Images, JsonEncoder from autocnet.graph.node import NetworkNode from autocnet.transformation import roi from autocnet.transformation.affine import estimate_affine_transformation from autocnet.transformation.affine import estimate_affine_from_sensors from autocnet import spatial from autocnet.utils.utils import bytescale Loading Loading @@ -846,7 +846,7 @@ def geom_match_simple(reference_image, match_func = check_match_func(match_func) # Estimate the transformation between the two images affine = estimate_affine_transformation(reference_image, moving_image, bcenter_x, bcenter_y) affine = estimate_affine_from_sensors(reference_image, moving_image, bcenter_x, bcenter_y) t2 = time.time() print(f'Estimation of the transformation took {t2-t1} seconds.') Loading Loading @@ -1230,7 +1230,7 @@ def geom_match(destination_cube, # Estimate the transformation affine = estimate_affine_transformation(destination_corners, source_corners) affine = estimate_affine_from_sensors(destination_corners, source_corners) # Apply the subpixel matcher with an affine transformation restemplate = subpixel_transformed_template(bcenter_x, bcenter_y, Loading Loading @@ -2083,7 +2083,7 @@ def subpixel_register_point_smart(pointid, print('geom_func', geom_func) try: affine = estimate_affine_transformation(source_node.geodata, affine = estimate_affine_from_sensors(source_node.geodata, destination_node.geodata, source.apriorisample, source.aprioriline) Loading Loading @@ -2394,7 +2394,7 @@ def validate_candidate_measure(measure_to_register, print(f'Validating measure: {measure_to_register_id} on image: {source_image.name}') try: affine = estimate_affine_transformation(source_node.geodata, destination_node.geodata, sample, line) affine = estimate_affine_from_sensors(source_node.geodata, destination_node.geodata, sample, line) except: print('Unable to transform image to reference space. Likely too close to the edge of the non-reference image. Setting ignore=True') return [np.inf] * len(parameters) Loading
autocnet/transformation/affine.py +7 −7 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ from autocnet.spatial import isis log = logging.getLogger(__name__) def estimate_affine_transformation(reference_image, def estimate_affine_from_sensors(reference_image, moving_image, bcenter_x, bcenter_y, Loading Loading @@ -85,5 +85,5 @@ def estimate_affine_transformation(reference_image, affine = tf.estimate_transform('affine', np.array([*base_gcps]), np.array([*dst_gcps])) t2 = time.time() print(f'Estimation of the transformation took {t2-t1} seconds.') log.debug(f'Estimation of the transformation took {t2-t1} seconds.') return affine No newline at end of file
autocnet/transformation/tests/test_affine.py +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ from autocnet.transformation import affine def test_estimate_affine_transformation(): gd_base = GeoDataset('tests/test_subpixel_match/B08_012650_1780_XN_02S046W.l1.cal.destriped.crop.cub') gd_match = GeoDataset('tests/test_subpixel_match/J04_046447_1777_XI_02S046W.l1.cal.destriped.crop.cub') affine_transform = affine.estimate_affine_transformation(gd_base,gd_match, 150, 150) affine_transform = affine.estimate_affine_from_sensors(gd_base, gd_match, 150, 150) assert affine_transform.rotation == pytest.approx(-0.0012609633370663982, 6) assert affine_transform.shear == pytest.approx(0.01262411827876344) assert affine_transform.scale[0] == pytest.approx(1.0, 6) Loading