diff --git a/include/ale/Distortion.h b/include/ale/Distortion.h index 4372766ec..dd2aa4aec 100644 --- a/include/ale/Distortion.h +++ b/include/ale/Distortion.h @@ -9,7 +9,8 @@ namespace ale { DAWNFC, LROLROCNAC, CAHVOR, - LUNARORBITER + LUNARORBITER, + RADTAN }; } diff --git a/src/Util.cpp b/src/Util.cpp index 52e080075..8afcfa164 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -342,9 +342,9 @@ double getSemiMinorRadius(json isd) { // type. Defaults to transverse DistortionType getDistortionModel(json isd) { try { - json distoriton_subset = isd.at("optical_distortion"); + json distortion_subset = isd.at("optical_distortion"); - json::iterator it = distoriton_subset.begin(); + json::iterator it = distortion_subset.begin(); std::string distortion = (std::string)it.key(); @@ -362,6 +362,8 @@ DistortionType getDistortionModel(json isd) { return DistortionType::CAHVOR; } else if (distortion.compare("lunarorbiter") == 0) { return DistortionType::LUNARORBITER; + } else if (distortion.compare("radtan") == 0) { + return DistortionType::RADTAN; } } catch (...) { throw std::runtime_error("Could not parse the distortion model."); @@ -528,6 +530,20 @@ std::vector getDistortionCoeffs(json isd) { coefficients = std::vector(4, 0.0); } } break; + case DistortionType::RADTAN: { + try { + coefficients = isd.at("optical_distortion") + .at("radtan") + .at("coefficients") + .get>(); + + return coefficients; + } catch (...) { + throw std::runtime_error( + "Could not parse the radtan distortion model coefficients."); + coefficients = std::vector(5, 0.0); + } + } break; } throw std::runtime_error( "Could not parse the distortion model coefficients.");