aws.osml.photogrammetry.replacement_sensor_model module
- class aws.osml.photogrammetry.replacement_sensor_model.RSMImageDomain(min_row: int, max_row: int, min_column: int, max_column: int)[source]
Bases:
object
This RSM image domain is a rectangle defined by the minimum and maximum discrete row coordinate values, and the minimum and maximum discrete column coordinate values. It is typically constructed from values in the NITF RSMID TRE. For more information see section 5.5 of STDI-0002 Volume 1 Appendix U.
- class aws.osml.photogrammetry.replacement_sensor_model.RSMGroundDomainForm(value)[source]
Bases:
Enum
The RSMGroundDomainForm defines how world coordinates (x, y, z) should be interpreted in this sensor model.
If geodetic, X, Y, and Z, correspond to longitude, latitude, and height above the ellipsoid, respectively. Longitude is specified east of the prime meridian, and latitude is specified north of the equator. Units for X, Y, and Z, are radians, radians, and meters, respectively. The range for Y is (-pi/2 to pi/2). The range for X is (-pi to pi) when GEODETIC, and (0 to 2pi) when GEODETIC_2PI. The latter is specified when the RSM ground domain contains a longitude value near pi radians.
If RECTANGULAR, X, Y, and Z correspond to a coordinate system that is defined as an offset from and rotation about the WGS 84 Rectangular coordinate system.
For more information see the GRNDD TRE field definition in section 5.9 of STDI-0002 Volume 1 Appendix U.
- GEODETIC = 'G'
- GEODETIC_2PI = 'H'
- RECTANGULAR = 'R'
- class aws.osml.photogrammetry.replacement_sensor_model.RSMGroundDomain(ground_domain_form: RSMGroundDomainForm, ground_domain_vertices: List[WorldCoordinate], rectangular_coordinate_origin: WorldCoordinate | None = None, rectangular_coordinate_unit_vectors: Any | None = None, ground_reference_point: WorldCoordinate | None = None)[source]
Bases:
object
The RSM ground domain is an approximation of the ground area where the RSM representation is valid. It is a solid in three-dimensional space bounded by a hexahedron with quadrilateral faces specified using eight three-dimensional vertices.
It is typically constructed from values in the NITF RSMID TRE. For more information see section 5.6 of STDI-0002 Volume 1 Appendix U.
- geodetic_to_ground_domain_coordinate(geodetic_coordinate: GeodeticWorldCoordinate) WorldCoordinate [source]
This function converts WGS-84 geodetic world coordinate into a world coordinate that uses the domain coordinate system for this sensor model.
- Parameters:
geodetic_coordinate – the WGS-84 longitude, latitude, elevation
- Returns:
the x, y, z domain coordinate
- ground_domain_coordinate_to_geodetic(ground_domain_coordinate: WorldCoordinate) GeodeticWorldCoordinate [source]
This function converts an x, y, z coordinate defined in the ground domain of this sensor model into a WGS-84 longitude, latitude, elevation coordinate.
- Parameters:
ground_domain_coordinate – the x, y, z domain coordinate
- Returns:
the WGS-84 longitude, latitude, elevation coordinate
- class aws.osml.photogrammetry.replacement_sensor_model.RSMContext(ground_domain: RSMGroundDomain, image_domain: RSMImageDomain)[source]
Bases:
object
The RSM context contains information necessary to apply and interpret results from the sensor models on an image.
This current implementation only covers the ground domain and image domains necessary for georeferencing but it can be expanded as needed to support other RSM functions.
TODO: Implement the TimeContext which can be used to identify the collection time of any x, y image coordinate TODO: Implement the IlluminationContext which can be used to predict shadow information on an image TODO: Implement the TrajectoryModel which captures the sensors 3D position in relation to the image
- class aws.osml.photogrammetry.replacement_sensor_model.RSMPolynomial(max_power_x: int, max_power_y: int, max_power_z: int, coefficients: List[float])[source]
Bases:
object
This is an implementation of a general polynomial that can be applied to a world coordinate (i.e. an x,y,z vector). For additional information see Section 7.2 of STDI-0002 Volume 1 Appendix U or Section 10.3.3.1.1 of the Manual of Photogrammetry Sixth Edition.
- evaluate(normalized_world_coordinate: WorldCoordinate) float [source]
This function evaluates the polynomial for the given world coordinate by summing up the result of applying each coefficient to the world coordinate components. Note that these polynomials are usually defined with the assumption that the world coordinate has been normalized.
- Parameters:
normalized_world_coordinate – the world coordinate
- Returns:
the resulting value
- class aws.osml.photogrammetry.replacement_sensor_model.RSMLowOrderPolynomial(coefficients: List[float])[source]
Bases:
object
This is an implementation of a “low order” polynomial used when generating coarse image row and column coordinates from a world coordinate. For additional information see Section 6.2 of STDI-0002 Volume 1 Appendix U.
- evaluate(world_coordinate: WorldCoordinate)[source]
This function evaluates the polynomial for the given world coordinate by summing up the result of applying each coefficient to the world coordinate components.
- Parameters:
world_coordinate – the world coordinate
- Returns:
the resulting value
- class aws.osml.photogrammetry.replacement_sensor_model.RSMSensorModel(context: RSMContext)[source]
Bases:
SensorModel
,ABC
This is an abstract base for all sensor models that use the RSM context information.
- class aws.osml.photogrammetry.replacement_sensor_model.RSMPolynomialSensorModel(context: RSMContext, section_row: int, section_col: int, row_norm_offset: float, column_norm_offset: float, x_norm_offset: float, y_norm_offset: float, z_norm_offset: float, row_norm_scale: float, column_norm_scale: float, x_norm_scale: float, y_norm_scale: float, z_norm_scale: float, row_numerator_poly: RSMPolynomial, row_denominator_poly: RSMPolynomial, column_numerator_poly: RSMPolynomial, column_denominator_poly: RSMPolynomial)[source]
Bases:
RSMSensorModel
This is an implementation of a Rational Polynomial Camera as defined in section 10.3.3.1.1 of the Manual of Photogrammetry Sixth Edition.
- world_to_image(geodetic_coordinate: GeodeticWorldCoordinate) ImageCoordinate [source]
This function transforms a geodetic world coordinate (longitude, latitude, elevation) into an image coordinate (x, y).
- Parameters:
geodetic_coordinate – the world coordinate (longitude, latitude, elevation)
- Returns:
the resulting image coordinate (x,y)
- image_to_world(image_coordinate: ImageCoordinate, elevation_model: ElevationModel | None = None, options: Dict[str, Any] | None = None) GeodeticWorldCoordinate [source]
This function implements the image to world transform by iteratively invoking world to image within a minimization routine to find a matching image coordinate. The longitude and latitude parameters are searched independently while the elevation of the world coordinate comes from the surface provided with the ground domain.
- Parameters:
image_coordinate – the image coordinate (x, y)
elevation_model – an optional elevation model used transform the coordinate
options – optional hints, supports initial_guess and initial_search_distance
- Returns:
the corresponding world coordinate
- ground_domain_to_image(domain_coordinate: WorldCoordinate) ImageCoordinate [source]
This function implements the polynomial ground-to-image transform as defined by section 10.3.3.1.1 of the Manual of Photogrammetry sixth edition. The world coordinate is first normalized using the offsets and scale factors provided. Then the rational polynomial equations are run to produce an x,y image coordinate. Those components are then denormalized to find the final image coordinate.
- Parameters:
domain_coordinate – the ground domain coordinate (x, y, z)
- Returns:
the image coordinate (x, y)
- normalize_world_coordinate(world_coordinate: WorldCoordinate) WorldCoordinate [source]
This is a helper function used to normalize a world coordinate for use with the polynomials in this sensor model.
- Parameters:
world_coordinate – the world coordinate (longitude, latitude, elevation)
- Returns:
a world coordinate where each component has been normalized
- denormalize_world_coordinate(world_coordinate: WorldCoordinate) WorldCoordinate [source]
This is a helper function used to denormalize a world coordinate for use with the polynomials in this sensor model.
- Parameters:
world_coordinate – the normalized world coordinate (longitude, latitude, elevation)
- Returns:
a world coordinate
- normalize_image_coordinate(image_coordinate: ImageCoordinate) ImageCoordinate [source]
This is a helper function used to normalize an image coordinate for use in these polynomials.
- Parameters:
image_coordinate – the image coordinate (x, y)
- Returns:
the normalized image coordinate (x, y)
- denormalize_image_coordinate(image_coordinate: ImageCoordinate) ImageCoordinate [source]
This is a helper function to denormalize an image coordinate after it has been processed by the polynomials.
- Parameters:
image_coordinate – the normalized image coordinate (x, y)
- Returns:
the image coordinate (x, y)
- static normalize(value: float, offset: float, scale: float) float [source]
This function normalizes a value using an offset and scale using the equations defined in Section 7.2 of STDI-0002 Volume 1 Appendix U.
- Parameters:
value – the value to be normalized
offset – the normalization offset
scale – the normalization scale
- Returns:
the normalized value
- static denormalize(value: float, offset: float, scale: float) float [source]
This function denormalizes a value using an offset and scale using the equations defined in Section 7.2 of STDI-0002 Volume 1 Appendix U.
- Parameters:
value – the normalized value
offset – the normalization offset
scale – the normalization scale
- Returns:
the denormalized value
- class aws.osml.photogrammetry.replacement_sensor_model.RSMSectionedPolynomialSensorModel(context: RSMContext, row_num_image_sections: int, column_num_image_sections: int, row_section_size: float, column_section_size: float, row_polynomial: RSMLowOrderPolynomial, column_polynomial: RSMLowOrderPolynomial, section_sensor_models: List[List[SensorModel]])[source]
Bases:
RSMSensorModel
This is an implementation of a sectioned sensor model that splits overall RSM domain into multiple regions each serviced by a dedicated sensor model. A low complexity sensor model covering the entire domain is used to first identify the general region of the image associated with a world coordinate then the final coordinate transform is delegated to a sensor model associated with that section.
- world_to_image(geodetic_coordinate: GeodeticWorldCoordinate) ImageCoordinate [source]
This function transforms a geodetic world coordinate (longitude, latitude, elevation) into an image coordinate (x, y).
- Parameters:
geodetic_coordinate – the world coordinate (longitude, latitude, elevation)
- Returns:
the resulting image coordinate (x,y)
- image_to_world(image_coordinate: ImageCoordinate, elevation_model: ElevationModel | None = None, options: Dict[str, Any] | None = None) GeodeticWorldCoordinate [source]
This function implements the image to world transform by selecting the sensor model responsible for coordinates in the image section and then delegating the image to world calculations to that sensor model.
- Parameters:
image_coordinate – the image coordinate (x, y)
elevation_model – optional elevation model used to transform the coordinate
options – optional dictionary of hints passed on to the section sensor models
- Returns:
the corresponding world coordinate (longitude, latitude, elevation)
- get_section_index(image_coordinate: ImageCoordinate) Tuple[int, int] [source]
Use the equations from STDO-0002 Volume 1 Appendix U Section 6.3 to calculate the section of this image containing the rough x, y. Note that these equations are slightly different from the documentation since those equations produce section numbers that start with 1, and we’re starting with 0 to more naturally index into the array of sensor models. Note that if the value is outside the normal sections it is clamped to use the sensor model from the closest section available.
- Parameters:
image_coordinate – the image coordinate (x, y)
- Returns:
section index (x, y)