Skip to content
Snippets Groups Projects
Commit 6318b8bd authored by Oleg Alexandrov's avatar Oleg Alexandrov
Browse files

Sync up with ale

parent a055c42b
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
#include <tuple> #include <tuple>
#include <vector> #include <vector>
enum DistortionType { RADIAL, TRANSVERSE, KAGUYALISM, DAWNFC, LROLROCNAC, CAHVOR, RADTAN }; // This should be synched with the enum in ale/Distortion.h
enum DistortionType { RADIAL, TRANSVERSE, KAGUYALISM, DAWNFC, LROLROCNAC, CAHVOR,
LUNARORBITER, RADTAN };
// Transverse distortion Jacobian // Transverse distortion Jacobian
void transverseDistortionJacobian(double x, double y, double *jacobian, void transverseDistortionJacobian(double x, double y, double *jacobian,
...@@ -23,6 +25,7 @@ void removeDistortion(double dx, double dy, double &ux, double &uy, ...@@ -23,6 +25,7 @@ void removeDistortion(double dx, double dy, double &ux, double &uy,
void applyDistortion(double ux, double uy, double &dx, double &dy, void applyDistortion(double ux, double uy, double &dx, double &dy,
std::vector<double> const& opticalDistCoeffs, std::vector<double> const& opticalDistCoeffs,
DistortionType distortionType, DistortionType distortionType,
const double desiredPrecision = 1.0E-6, const double desiredPrecisio
n = 1.0E-6,
const double tolerance = 1.0E-6); const double tolerance = 1.0E-6);
#endif // INCLUDE_USGSCSM_DISTORTION_H_ #endif // INCLUDE_USGSCSM_DISTORTION_H_
...@@ -1060,9 +1060,9 @@ double getSemiMinorRadius(json isd, csm::WarningList *list) { ...@@ -1060,9 +1060,9 @@ double getSemiMinorRadius(json isd, csm::WarningList *list) {
// type. Defaults to transverse // type. Defaults to transverse
DistortionType getDistortionModel(json isd, csm::WarningList *list) { DistortionType getDistortionModel(json isd, csm::WarningList *list) {
try { 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(); std::string distortion = (std::string)it.key();
...@@ -1076,6 +1076,12 @@ DistortionType getDistortionModel(json isd, csm::WarningList *list) { ...@@ -1076,6 +1076,12 @@ DistortionType getDistortionModel(json isd, csm::WarningList *list) {
return DistortionType::DAWNFC; return DistortionType::DAWNFC;
} else if (distortion.compare("lrolrocnac") == 0) { } else if (distortion.compare("lrolrocnac") == 0) {
return DistortionType::LROLROCNAC; return DistortionType::LROLROCNAC;
} else if (distortion.compare("cahvor") == 0) {
return DistortionType::CAHVOR;
} else if (distortion.compare("lunarorbiter") == 0) {
return DistortionType::LUNARORBITER;
} else if (distortion.compare("radtan") == 0) {
return DistortionType::RADTAN;
} }
} catch (...) { } catch (...) {
if (list) { if (list) {
...@@ -1105,6 +1111,10 @@ DistortionType getDistortionModel(int aleDistortionModel, ...@@ -1105,6 +1111,10 @@ DistortionType getDistortionModel(int aleDistortionModel,
return DistortionType::LROLROCNAC; return DistortionType::LROLROCNAC;
}else if (aleDistortionType == ale::DistortionType::CAHVOR) { }else if (aleDistortionType == ale::DistortionType::CAHVOR) {
return DistortionType::CAHVOR; return DistortionType::CAHVOR;
}else if (aleDistortionType == ale::DistortionType::LUNARORBITER) {
return DistortionType::LUNARORBITER;
}else if (aleDistortionType == ale::DistortionType::RADTAN) {
return DistortionType::RADTAN;
} }
} catch (...) { } catch (...) {
if (list) { if (list) {
...@@ -1263,7 +1273,26 @@ std::vector<double> getDistortionCoeffs(json isd, csm::WarningList *list) { ...@@ -1263,7 +1273,26 @@ std::vector<double> getDistortionCoeffs(json isd, csm::WarningList *list) {
coefficients = std::vector<double>(6, 0.0); coefficients = std::vector<double>(6, 0.0);
} }
} break; } break;
case DistortionType::RADTAN: {
try {
coefficients = isd.at("optical_distortion")
.at("radtan")
.at("coefficients")
.get<std::vector<double>>();
return coefficients;
} catch (...) {
if (list) {
list->push_back(csm::Warning(
csm::Warning::DATA_NOT_AVAILABLE,
"Could not parse the radtan distortion model coefficients.",
"Utilities::getDistortion()"));
}
coefficients = std::vector<double>(5, 0.0);
}
} break;
} }
if (list) { if (list) {
list->push_back( list->push_back(
csm::Warning(csm::Warning::DATA_NOT_AVAILABLE, csm::Warning(csm::Warning::DATA_NOT_AVAILABLE,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment