Loading CMakeLists.txt +10 −4 Original line number Diff line number Diff line Loading @@ -61,11 +61,16 @@ else() set(EIGEN3_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ale/eigen) endif(USGSCSM_EXTERNAL_DEPS) # Proj find_package(PROJ REQUIRED CONFIG) set(PROJ_TARGET PROJ::proj) add_library(usgscsm SHARED src/UsgsAstroPlugin.cpp src/UsgsAstroFrameSensorModel.cpp src/UsgsAstroPushFrameSensorModel.cpp src/UsgsAstroLsSensorModel.cpp src/UsgsAstroProjectedLsSensorModel.cpp src/UsgsAstroSarSensorModel.cpp src/Distortion.cpp src/Utilities.cpp Loading @@ -75,11 +80,11 @@ set_target_properties(usgscsm PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 1 ) set(USGSCSM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include/usgscsm" "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}" "${EIGEN3_INCLUDE_DIR}") "${EIGEN3_INCLUDE_DIR}" "${PROJ_INCLUDE_DIR}") # These will be copied upon installation to ${CMAKE_INSTALL_INCLUDEDIR}/include set(USGSCSM_INSTALL_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include/usgscsm" Loading @@ -94,6 +99,7 @@ target_include_directories(usgscsm target_link_libraries(usgscsm ${CSM_LIBRARY} ${ALE_TARGET} ${PROJ_TARGET} nlohmann_json::nlohmann_json) add_executable(usgscsm_cam_test bin/usgscsm_cam_test.cc) Loading environment.yml +3 −2 Original line number Diff line number Diff line Loading @@ -4,8 +4,9 @@ channels: - default dependencies: - cmake>=3.15 - ale>=0.8.8 - cmake>=3.15 - csm - nlohmann_json - eigen - nlohmann_json - proj include/usgscsm/UsgsAstroProjectedLsSensorModel.h 0 → 100644 +266 −0 Original line number Diff line number Diff line /** Copyright © 2017-2022 BAE Systems Information and Electronic Systems Integration Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **/ #ifndef INCLUDE_USGSCSM_USGSASTROPROJECTEDLSSENSORMODEL_H_ #define INCLUDE_USGSCSM_USGSASTROPROJECTEDLSSENSORMODEL_H_ #include <RasterGM.h> #include <SettableEllipsoid.h> #include<utility> #include<memory> #include<string> #include<vector> #include "ale/Orientations.h" #include "ale/States.h" #include "spdlog/spdlog.h" #include "UsgsAstroLsSensorModel.h" class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel { public: // Initializes the class from state data as formatted // in a string by the toString() method void setState(const std::string& state); virtual void replaceModelState(const std::string& stateString); //> This method attempts to initialize the current model with the state // given by argState. The argState argument can be a string previously // retrieved from the getModelState method. // // If argState contains a valid state for the current model, // the internal state of the model is updated. // // If the model cannot be updated to the given state, a csm::Error is // thrown and the internal state of the model is undefined. // // If the argument state string is empty, the model remains unchanged. //< // This method checks to see if the model name is recognized // in the input state string. static std::string getModelNameFromModelState(const std::string& model_state); std::string constructStateFromIsd(const std::string imageSupportData, csm::WarningList* list); // State data elements; std::vector<double> m_geoTransform; std::string m_projString; // Define logging pointer and file content std::shared_ptr<spdlog::logger> m_logger = spdlog::get("usgscsm_logger"); // Hardcoded static const std::string _SENSOR_MODEL_NAME; // state date element 0 static const std::string _STATE_KEYWORD[]; // Set to default values void reset(); //-------------------------------------------------------------- // Constructors/Destructor //-------------------------------------------------------------- UsgsAstroProjectedLsSensorModel(); ~UsgsAstroProjectedLsSensorModel(); virtual std::string getModelState() const; // Set the sensor model based on the input state data void set(const std::string& state_data); //---------------------------------------------------------------- // The following public methods are implementations of // the methods inherited from RasterGM and SettableEllipsoid. // These are defined in the CSM API. //---------------------------------------------------------------- //--- // Core Photogrammetry //--- virtual csm::ImageCoord groundToImage( const csm::EcefCoord& groundPt, double desiredPrecision = 0.001, double* achievedPrecision = NULL, csm::WarningList* warnings = NULL) const; //> This method converts the given groundPt (x,y,z in ECEF meters) to a // returned image coordinate (line, sample in full image space pixels). // // Iterative algorithms will use desiredPrecision, in meters, as the // convergence criterion, otherwise it will be ignored. // // If a non-NULL achievedPrecision argument is received, it will be // populated with the actual precision, in meters, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated // as applicable. //< virtual csm::ImageCoordCovar groundToImage( const csm::EcefCoordCovar& groundPt, double desiredPrecision = 0.001, double* achievedPrecision = NULL, csm::WarningList* warnings = NULL) const; //> This method converts the given groundPt (x,y,z in ECEF meters and // corresponding 3x3 covariance in ECEF meters squared) to a returned // image coordinate with covariance (line, sample in full image space // pixels and corresponding 2x2 covariance in pixels squared). // // Iterative algorithms will use desiredPrecision, in meters, as the // convergence criterion, otherwise it will be ignored. // // If a non-NULL achievedPrecision argument is received, it will be // populated with the actual precision, in meters, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated // as applicable. //< virtual csm::EcefCoord imageToGround(const csm::ImageCoord& imagePt, double height, double desiredPrecision = 0.001, double* achievedPrecision = NULL, csm::WarningList* warnings = NULL) const; //> This method converts the given imagePt (line,sample in full image // space pixels) and given height (in meters relative to the WGS-84 // ellipsoid) to a returned ground coordinate (x,y,z in ECEF meters). // // Iterative algorithms will use desiredPrecision, in meters, as the // convergence criterion, otherwise it will be ignored. // // If a non-NULL achievedPrecision argument is received, it will be // populated with the actual precision, in meters, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated // as applicable. //< virtual csm::EcefCoordCovar imageToGround( const csm::ImageCoordCovar& imagePt, double height, double heightVariance, double desiredPrecision = 0.001, double* achievedPrecision = NULL, csm::WarningList* warnings = NULL) const; //> This method converts the given imagePt (line, sample in full image // space pixels and corresponding 2x2 covariance in pixels squared) // and given height (in meters relative to the WGS-84 ellipsoid) and // corresponding heightVariance (in meters) to a returned ground // coordinate with covariance (x,y,z in ECEF meters and corresponding // 3x3 covariance in ECEF meters squared). // // Iterative algorithms will use desiredPrecision, in meters, as the // convergence criterion, otherwise it will be ignored. // // If a non-NULL achievedPrecision argument is received, it will be // populated with the actual precision, in meters, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated // as applicable. //< virtual csm::EcefLocus imageToProximateImagingLocus( const csm::ImageCoord& imagePt, const csm::EcefCoord& groundPt, double desiredPrecision = 0.001, double* achievedPrecision = NULL, csm::WarningList* warnings = NULL) const; //> This method, for the given imagePt (line, sample in full image space // pixels), returns the position and direction of the imaging locus // nearest the given groundPt (x,y,z in ECEF meters). // // Note that there are two opposite directions possible. Both are // valid, so either can be returned; the calling application can convert // to the other as necessary. // // Iterative algorithms will use desiredPrecision, in meters, as the // convergence criterion for the locus position, otherwise it will be // ignored. // // If a non-NULL achievedPrecision argument is received, it will be // populated with the actual precision, in meters, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated // as applicable. //< virtual csm::EcefLocus imageToRemoteImagingLocus( const csm::ImageCoord& imagePt, double desiredPrecision = 0.001, double* achievedPrecision = NULL, csm::WarningList* warnings = NULL) const; //> This method, for the given imagePt (line, sample in full image space // pixels), returns the position and direction of the imaging locus // at the sensor. // // Note that there are two opposite directions possible. Both are // valid, so either can be returned; the calling application can convert // to the other as necessary. // // Iterative algorithms will use desiredPrecision, in meters, as the // convergence criterion for the locus position, otherwise it will be // ignored. // // If a non-NULL achievedPrecision argument is received, it will be // populated with the actual precision, in meters, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated // as applicable. // // Notes: // // The remote imaging locus is only well-defined for optical sensors. // It is undefined for SAR sensors and might not be available for // polynomial and other non-physical models. The // imageToProximateImagingLocus method should be used instead where // possible. //< //--- // Error Correction //--- virtual csm::Version getVersion() const; //> This method returns the version of the model code. The Version // object can be compared to other Version objects with its comparison // operators. Not to be confused with the CSM API version. //< virtual std::string getModelName() const; //> This method returns a string identifying the name of the model. //< virtual std::string getPedigree() const; //> This method returns a string that identifies the sensor, // the model type, its mode of acquisition and processing path. // For example, an optical sensor model or a cubic rational polynomial // model created from the same sensor's support data would produce // different pedigrees for each case. //< }; #endif // INCLUDE_USGSCSM_USGSASTROPROJECTEDLSSENSORMODEL_H_ include/usgscsm/Utilities.h +4 −0 Original line number Diff line number Diff line Loading @@ -199,4 +199,8 @@ void applyRotationTranslationToXyzVec(ale::Rotation const& r, ale::Vec3d const& // to a calendar time string, such as 2000-01-01T00:16:40Z. std::string ephemTimeToCalendarTime(double ephemTime); std::vector<double> pixelToMeter(double line, double sample, std::vector<double> geoTransform); std::vector<double> meterToPixel(double meter_x, double meter_y, std::vector<double> geoTransform); #endif // INCLUDE_USGSCSM_UTILITIES_H_ src/UsgsAstroLsSensorModel.cpp +13 −13 Original line number Diff line number Diff line Loading @@ -702,7 +702,7 @@ csm::ImageCoord UsgsAstroLsSensorModel::groundToImage( ground_pt.x, ground_pt.y, ground_pt.z, desired_precision); // The public interface invokes the private interface with no adjustments. csm::ImageCoord imagePt = groundToImage( csm::ImageCoord imagePt = UsgsAstroLsSensorModel::groundToImage( ground_pt, _no_adjustment, desired_precision, achieved_precision, warnings); MESSAGE_LOG( spdlog::level::info, Loading Loading @@ -837,7 +837,7 @@ csm::ImageCoordCovar UsgsAstroLsSensorModel::groundToImage( gp.z = groundPt.z; csm::ImageCoord ip = groundToImage(gp, desired_precision, achieved_precision, warnings); UsgsAstroLsSensorModel::groundToImage(gp, desired_precision, achieved_precision, warnings); csm::ImageCoordCovar result(ip.line, ip.samp); // Compute partials ls wrt XYZ Loading Loading @@ -968,20 +968,20 @@ csm::EcefCoordCovar UsgsAstroLsSensorModel::imageToGround( const double DELTA_GROUND = m_gsd; csm::ImageCoord ip(image_pt.line, image_pt.samp); csm::EcefCoord gp = imageToGround(ip, height, desired_precision, csm::EcefCoord gp = UsgsAstroLsSensorModel::imageToGround(ip, height, desired_precision, achieved_precision, warnings); // Compute numerical partials xyz wrt to lsh ip.line = image_pt.line + DELTA_IMAGE; ip.samp = image_pt.samp; csm::EcefCoord gpl = imageToGround(ip, height, desired_precision); csm::EcefCoord gpl = UsgsAstroLsSensorModel::imageToGround(ip, height, desired_precision); double xpl = (gpl.x - gp.x) / DELTA_IMAGE; double ypl = (gpl.y - gp.y) / DELTA_IMAGE; double zpl = (gpl.z - gp.z) / DELTA_IMAGE; ip.line = image_pt.line; ip.samp = image_pt.samp + DELTA_IMAGE; csm::EcefCoord gps = imageToGround(ip, height, desired_precision); csm::EcefCoord gps = UsgsAstroLsSensorModel::imageToGround(ip, height, desired_precision); double xps = (gps.x - gp.x) / DELTA_IMAGE; double yps = (gps.y - gp.y) / DELTA_IMAGE; double zps = (gps.z - gp.z) / DELTA_IMAGE; Loading @@ -989,7 +989,7 @@ csm::EcefCoordCovar UsgsAstroLsSensorModel::imageToGround( ip.line = image_pt.line; ip.samp = image_pt.samp; csm::EcefCoord gph = imageToGround(ip, height + DELTA_GROUND, desired_precision); UsgsAstroLsSensorModel::imageToGround(ip, height + DELTA_GROUND, desired_precision); double xph = (gph.x - gp.x) / DELTA_GROUND; double yph = (gph.y - gp.y) / DELTA_GROUND; double zph = (gph.z - gp.z) / DELTA_GROUND; Loading Loading @@ -1064,7 +1064,7 @@ csm::EcefLocus UsgsAstroLsSensorModel::imageToProximateImagingLocus( // Ground point on object ray with the same elevation csm::EcefCoord gp1 = imageToGround(image_pt, height, desired_precision, achieved_precision); UsgsAstroLsSensorModel::imageToGround(image_pt, height, desired_precision, achieved_precision); // Vector between 2 ground points above double dx1 = x - gp1.x; Loading @@ -1072,7 +1072,7 @@ csm::EcefLocus UsgsAstroLsSensorModel::imageToProximateImagingLocus( double dz1 = z - gp1.z; // Unit vector along object ray csm::EcefCoord gp2 = imageToGround(image_pt, height - DELTA_GROUND, csm::EcefCoord gp2 = UsgsAstroLsSensorModel::imageToGround(image_pt, height - DELTA_GROUND, desired_precision, achieved_precision); double dx2 = gp2.x - gp1.x; double dy2 = gp2.y - gp1.y; Loading @@ -1093,7 +1093,7 @@ csm::EcefLocus UsgsAstroLsSensorModel::imageToProximateImagingLocus( double hLocus = computeEllipsoidElevation(gp2.x, gp2.y, gp2.z, m_majorAxis, m_minorAxis, desired_precision); locus.point = imageToGround(image_pt, hLocus, desired_precision, locus.point = UsgsAstroLsSensorModel::imageToGround(image_pt, hLocus, desired_precision, achieved_precision, warnings); locus.direction.x = dx2; Loading Loading @@ -2735,7 +2735,7 @@ std::string UsgsAstroLsSensorModel::constructStateFromIsd( } throw csm::Error(csm::Error::SENSOR_MODEL_NOT_CONSTRUCTIBLE, "ISD is invalid for creating the sensor model.", "UsgsAstroFrameSensorModel::constructStateFromIsd"); "UsgsAstroLsSensorModel::constructStateFromIsd"); } // The state data will still be updated when a sensor model is created since Loading Loading
CMakeLists.txt +10 −4 Original line number Diff line number Diff line Loading @@ -61,11 +61,16 @@ else() set(EIGEN3_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ale/eigen) endif(USGSCSM_EXTERNAL_DEPS) # Proj find_package(PROJ REQUIRED CONFIG) set(PROJ_TARGET PROJ::proj) add_library(usgscsm SHARED src/UsgsAstroPlugin.cpp src/UsgsAstroFrameSensorModel.cpp src/UsgsAstroPushFrameSensorModel.cpp src/UsgsAstroLsSensorModel.cpp src/UsgsAstroProjectedLsSensorModel.cpp src/UsgsAstroSarSensorModel.cpp src/Distortion.cpp src/Utilities.cpp Loading @@ -75,11 +80,11 @@ set_target_properties(usgscsm PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 1 ) set(USGSCSM_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include/usgscsm" "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}" "${EIGEN3_INCLUDE_DIR}") "${EIGEN3_INCLUDE_DIR}" "${PROJ_INCLUDE_DIR}") # These will be copied upon installation to ${CMAKE_INSTALL_INCLUDEDIR}/include set(USGSCSM_INSTALL_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include/usgscsm" Loading @@ -94,6 +99,7 @@ target_include_directories(usgscsm target_link_libraries(usgscsm ${CSM_LIBRARY} ${ALE_TARGET} ${PROJ_TARGET} nlohmann_json::nlohmann_json) add_executable(usgscsm_cam_test bin/usgscsm_cam_test.cc) Loading
environment.yml +3 −2 Original line number Diff line number Diff line Loading @@ -4,8 +4,9 @@ channels: - default dependencies: - cmake>=3.15 - ale>=0.8.8 - cmake>=3.15 - csm - nlohmann_json - eigen - nlohmann_json - proj
include/usgscsm/UsgsAstroProjectedLsSensorModel.h 0 → 100644 +266 −0 Original line number Diff line number Diff line /** Copyright © 2017-2022 BAE Systems Information and Electronic Systems Integration Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **/ #ifndef INCLUDE_USGSCSM_USGSASTROPROJECTEDLSSENSORMODEL_H_ #define INCLUDE_USGSCSM_USGSASTROPROJECTEDLSSENSORMODEL_H_ #include <RasterGM.h> #include <SettableEllipsoid.h> #include<utility> #include<memory> #include<string> #include<vector> #include "ale/Orientations.h" #include "ale/States.h" #include "spdlog/spdlog.h" #include "UsgsAstroLsSensorModel.h" class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel { public: // Initializes the class from state data as formatted // in a string by the toString() method void setState(const std::string& state); virtual void replaceModelState(const std::string& stateString); //> This method attempts to initialize the current model with the state // given by argState. The argState argument can be a string previously // retrieved from the getModelState method. // // If argState contains a valid state for the current model, // the internal state of the model is updated. // // If the model cannot be updated to the given state, a csm::Error is // thrown and the internal state of the model is undefined. // // If the argument state string is empty, the model remains unchanged. //< // This method checks to see if the model name is recognized // in the input state string. static std::string getModelNameFromModelState(const std::string& model_state); std::string constructStateFromIsd(const std::string imageSupportData, csm::WarningList* list); // State data elements; std::vector<double> m_geoTransform; std::string m_projString; // Define logging pointer and file content std::shared_ptr<spdlog::logger> m_logger = spdlog::get("usgscsm_logger"); // Hardcoded static const std::string _SENSOR_MODEL_NAME; // state date element 0 static const std::string _STATE_KEYWORD[]; // Set to default values void reset(); //-------------------------------------------------------------- // Constructors/Destructor //-------------------------------------------------------------- UsgsAstroProjectedLsSensorModel(); ~UsgsAstroProjectedLsSensorModel(); virtual std::string getModelState() const; // Set the sensor model based on the input state data void set(const std::string& state_data); //---------------------------------------------------------------- // The following public methods are implementations of // the methods inherited from RasterGM and SettableEllipsoid. // These are defined in the CSM API. //---------------------------------------------------------------- //--- // Core Photogrammetry //--- virtual csm::ImageCoord groundToImage( const csm::EcefCoord& groundPt, double desiredPrecision = 0.001, double* achievedPrecision = NULL, csm::WarningList* warnings = NULL) const; //> This method converts the given groundPt (x,y,z in ECEF meters) to a // returned image coordinate (line, sample in full image space pixels). // // Iterative algorithms will use desiredPrecision, in meters, as the // convergence criterion, otherwise it will be ignored. // // If a non-NULL achievedPrecision argument is received, it will be // populated with the actual precision, in meters, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated // as applicable. //< virtual csm::ImageCoordCovar groundToImage( const csm::EcefCoordCovar& groundPt, double desiredPrecision = 0.001, double* achievedPrecision = NULL, csm::WarningList* warnings = NULL) const; //> This method converts the given groundPt (x,y,z in ECEF meters and // corresponding 3x3 covariance in ECEF meters squared) to a returned // image coordinate with covariance (line, sample in full image space // pixels and corresponding 2x2 covariance in pixels squared). // // Iterative algorithms will use desiredPrecision, in meters, as the // convergence criterion, otherwise it will be ignored. // // If a non-NULL achievedPrecision argument is received, it will be // populated with the actual precision, in meters, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated // as applicable. //< virtual csm::EcefCoord imageToGround(const csm::ImageCoord& imagePt, double height, double desiredPrecision = 0.001, double* achievedPrecision = NULL, csm::WarningList* warnings = NULL) const; //> This method converts the given imagePt (line,sample in full image // space pixels) and given height (in meters relative to the WGS-84 // ellipsoid) to a returned ground coordinate (x,y,z in ECEF meters). // // Iterative algorithms will use desiredPrecision, in meters, as the // convergence criterion, otherwise it will be ignored. // // If a non-NULL achievedPrecision argument is received, it will be // populated with the actual precision, in meters, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated // as applicable. //< virtual csm::EcefCoordCovar imageToGround( const csm::ImageCoordCovar& imagePt, double height, double heightVariance, double desiredPrecision = 0.001, double* achievedPrecision = NULL, csm::WarningList* warnings = NULL) const; //> This method converts the given imagePt (line, sample in full image // space pixels and corresponding 2x2 covariance in pixels squared) // and given height (in meters relative to the WGS-84 ellipsoid) and // corresponding heightVariance (in meters) to a returned ground // coordinate with covariance (x,y,z in ECEF meters and corresponding // 3x3 covariance in ECEF meters squared). // // Iterative algorithms will use desiredPrecision, in meters, as the // convergence criterion, otherwise it will be ignored. // // If a non-NULL achievedPrecision argument is received, it will be // populated with the actual precision, in meters, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated // as applicable. //< virtual csm::EcefLocus imageToProximateImagingLocus( const csm::ImageCoord& imagePt, const csm::EcefCoord& groundPt, double desiredPrecision = 0.001, double* achievedPrecision = NULL, csm::WarningList* warnings = NULL) const; //> This method, for the given imagePt (line, sample in full image space // pixels), returns the position and direction of the imaging locus // nearest the given groundPt (x,y,z in ECEF meters). // // Note that there are two opposite directions possible. Both are // valid, so either can be returned; the calling application can convert // to the other as necessary. // // Iterative algorithms will use desiredPrecision, in meters, as the // convergence criterion for the locus position, otherwise it will be // ignored. // // If a non-NULL achievedPrecision argument is received, it will be // populated with the actual precision, in meters, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated // as applicable. //< virtual csm::EcefLocus imageToRemoteImagingLocus( const csm::ImageCoord& imagePt, double desiredPrecision = 0.001, double* achievedPrecision = NULL, csm::WarningList* warnings = NULL) const; //> This method, for the given imagePt (line, sample in full image space // pixels), returns the position and direction of the imaging locus // at the sensor. // // Note that there are two opposite directions possible. Both are // valid, so either can be returned; the calling application can convert // to the other as necessary. // // Iterative algorithms will use desiredPrecision, in meters, as the // convergence criterion for the locus position, otherwise it will be // ignored. // // If a non-NULL achievedPrecision argument is received, it will be // populated with the actual precision, in meters, achieved by iterative // algorithms and 0.0 for deterministic algorithms. // // If a non-NULL warnings argument is received, it will be populated // as applicable. // // Notes: // // The remote imaging locus is only well-defined for optical sensors. // It is undefined for SAR sensors and might not be available for // polynomial and other non-physical models. The // imageToProximateImagingLocus method should be used instead where // possible. //< //--- // Error Correction //--- virtual csm::Version getVersion() const; //> This method returns the version of the model code. The Version // object can be compared to other Version objects with its comparison // operators. Not to be confused with the CSM API version. //< virtual std::string getModelName() const; //> This method returns a string identifying the name of the model. //< virtual std::string getPedigree() const; //> This method returns a string that identifies the sensor, // the model type, its mode of acquisition and processing path. // For example, an optical sensor model or a cubic rational polynomial // model created from the same sensor's support data would produce // different pedigrees for each case. //< }; #endif // INCLUDE_USGSCSM_USGSASTROPROJECTEDLSSENSORMODEL_H_
include/usgscsm/Utilities.h +4 −0 Original line number Diff line number Diff line Loading @@ -199,4 +199,8 @@ void applyRotationTranslationToXyzVec(ale::Rotation const& r, ale::Vec3d const& // to a calendar time string, such as 2000-01-01T00:16:40Z. std::string ephemTimeToCalendarTime(double ephemTime); std::vector<double> pixelToMeter(double line, double sample, std::vector<double> geoTransform); std::vector<double> meterToPixel(double meter_x, double meter_y, std::vector<double> geoTransform); #endif // INCLUDE_USGSCSM_UTILITIES_H_
src/UsgsAstroLsSensorModel.cpp +13 −13 Original line number Diff line number Diff line Loading @@ -702,7 +702,7 @@ csm::ImageCoord UsgsAstroLsSensorModel::groundToImage( ground_pt.x, ground_pt.y, ground_pt.z, desired_precision); // The public interface invokes the private interface with no adjustments. csm::ImageCoord imagePt = groundToImage( csm::ImageCoord imagePt = UsgsAstroLsSensorModel::groundToImage( ground_pt, _no_adjustment, desired_precision, achieved_precision, warnings); MESSAGE_LOG( spdlog::level::info, Loading Loading @@ -837,7 +837,7 @@ csm::ImageCoordCovar UsgsAstroLsSensorModel::groundToImage( gp.z = groundPt.z; csm::ImageCoord ip = groundToImage(gp, desired_precision, achieved_precision, warnings); UsgsAstroLsSensorModel::groundToImage(gp, desired_precision, achieved_precision, warnings); csm::ImageCoordCovar result(ip.line, ip.samp); // Compute partials ls wrt XYZ Loading Loading @@ -968,20 +968,20 @@ csm::EcefCoordCovar UsgsAstroLsSensorModel::imageToGround( const double DELTA_GROUND = m_gsd; csm::ImageCoord ip(image_pt.line, image_pt.samp); csm::EcefCoord gp = imageToGround(ip, height, desired_precision, csm::EcefCoord gp = UsgsAstroLsSensorModel::imageToGround(ip, height, desired_precision, achieved_precision, warnings); // Compute numerical partials xyz wrt to lsh ip.line = image_pt.line + DELTA_IMAGE; ip.samp = image_pt.samp; csm::EcefCoord gpl = imageToGround(ip, height, desired_precision); csm::EcefCoord gpl = UsgsAstroLsSensorModel::imageToGround(ip, height, desired_precision); double xpl = (gpl.x - gp.x) / DELTA_IMAGE; double ypl = (gpl.y - gp.y) / DELTA_IMAGE; double zpl = (gpl.z - gp.z) / DELTA_IMAGE; ip.line = image_pt.line; ip.samp = image_pt.samp + DELTA_IMAGE; csm::EcefCoord gps = imageToGround(ip, height, desired_precision); csm::EcefCoord gps = UsgsAstroLsSensorModel::imageToGround(ip, height, desired_precision); double xps = (gps.x - gp.x) / DELTA_IMAGE; double yps = (gps.y - gp.y) / DELTA_IMAGE; double zps = (gps.z - gp.z) / DELTA_IMAGE; Loading @@ -989,7 +989,7 @@ csm::EcefCoordCovar UsgsAstroLsSensorModel::imageToGround( ip.line = image_pt.line; ip.samp = image_pt.samp; csm::EcefCoord gph = imageToGround(ip, height + DELTA_GROUND, desired_precision); UsgsAstroLsSensorModel::imageToGround(ip, height + DELTA_GROUND, desired_precision); double xph = (gph.x - gp.x) / DELTA_GROUND; double yph = (gph.y - gp.y) / DELTA_GROUND; double zph = (gph.z - gp.z) / DELTA_GROUND; Loading Loading @@ -1064,7 +1064,7 @@ csm::EcefLocus UsgsAstroLsSensorModel::imageToProximateImagingLocus( // Ground point on object ray with the same elevation csm::EcefCoord gp1 = imageToGround(image_pt, height, desired_precision, achieved_precision); UsgsAstroLsSensorModel::imageToGround(image_pt, height, desired_precision, achieved_precision); // Vector between 2 ground points above double dx1 = x - gp1.x; Loading @@ -1072,7 +1072,7 @@ csm::EcefLocus UsgsAstroLsSensorModel::imageToProximateImagingLocus( double dz1 = z - gp1.z; // Unit vector along object ray csm::EcefCoord gp2 = imageToGround(image_pt, height - DELTA_GROUND, csm::EcefCoord gp2 = UsgsAstroLsSensorModel::imageToGround(image_pt, height - DELTA_GROUND, desired_precision, achieved_precision); double dx2 = gp2.x - gp1.x; double dy2 = gp2.y - gp1.y; Loading @@ -1093,7 +1093,7 @@ csm::EcefLocus UsgsAstroLsSensorModel::imageToProximateImagingLocus( double hLocus = computeEllipsoidElevation(gp2.x, gp2.y, gp2.z, m_majorAxis, m_minorAxis, desired_precision); locus.point = imageToGround(image_pt, hLocus, desired_precision, locus.point = UsgsAstroLsSensorModel::imageToGround(image_pt, hLocus, desired_precision, achieved_precision, warnings); locus.direction.x = dx2; Loading Loading @@ -2735,7 +2735,7 @@ std::string UsgsAstroLsSensorModel::constructStateFromIsd( } throw csm::Error(csm::Error::SENSOR_MODEL_NOT_CONSTRUCTIBLE, "ISD is invalid for creating the sensor model.", "UsgsAstroFrameSensorModel::constructStateFromIsd"); "UsgsAstroLsSensorModel::constructStateFromIsd"); } // The state data will still be updated when a sensor model is created since Loading