diff --git a/Code/Projections/otbGCPsToRPCSensorModelImageFilter.txx b/Code/Projections/otbGCPsToRPCSensorModelImageFilter.txx index 164bc72e95605df6f6499c4537a63fa28ce493c4..7c0568a466905c7b585fcfe9b1fe45183a2c4226 100644 --- a/Code/Projections/otbGCPsToRPCSensorModelImageFilter.txx +++ b/Code/Projections/otbGCPsToRPCSensorModelImageFilter.txx @@ -291,17 +291,9 @@ GCPsToRPCSensorModelImageFilter<TImage> // First, retrieve the image pointer typename TImage::Pointer imagePtr = this->GetOutput(); - typename TImage::PointType ul = this->GetInput()->GetOrigin(); - typename TImage::SizeType size = this->GetInput()->GetLargestPossibleRegion().GetSize(); - typename TImage::SpacingType spacing = this->GetInput()->GetSpacing(); - - typename TImage::PointType lr; - lr[0] = ul[0] + size[0]*spacing[0]; - lr[1] = ul[1] + size[1]*spacing[1]; - double rmsError; ImageKeywordlist otb_kwl; - otb::RPCSolverAdapter::Solve(m_GCPsContainer, ul, lr, rmsError, otb_kwl); + otb::RPCSolverAdapter::Solve(m_GCPsContainer, rmsError, otb_kwl); // Retrieve the residual ground error m_RMSGroundError = rmsError; diff --git a/Code/UtilitiesAdapters/OssimAdapters/otbRPCSolverAdapter.cxx b/Code/UtilitiesAdapters/OssimAdapters/otbRPCSolverAdapter.cxx index 813972e56683ea3279c748c106efaac758fea975..0789f4b92fe02511eb5651566b52640e2069cb91 100644 --- a/Code/UtilitiesAdapters/OssimAdapters/otbRPCSolverAdapter.cxx +++ b/Code/UtilitiesAdapters/OssimAdapters/otbRPCSolverAdapter.cxx @@ -35,8 +35,6 @@ RPCSolverAdapter::~RPCSolverAdapter() void RPCSolverAdapter::Solve(const GCPsContainerType& gcpContainer, - const Point2DType& ulImagePoint, - const Point2DType& lrImagePoint, double& rmsError, ImageKeywordlist& otb_kwl) { @@ -56,21 +54,17 @@ RPCSolverAdapter::Solve(const GCPsContainerType& gcpContainer, for (gcpIt = gcpContainer.begin(); gcpIt != gcpContainer.end(); ++gcpIt) { // Check if point is inside bounds - if(gcpIt->first[0] >= ulImagePoint[0] && gcpIt->first[1] >= ulImagePoint[1] - && gcpIt->first[0] <= lrImagePoint[0] && gcpIt->first[1] <= lrImagePoint[1]) - { - // Fill sensor point - sensorPoint = ossimDpt(gcpIt->first[0], gcpIt->first[1]); - - // Fill geo point (lat, lon, elev) - geoPoint = ossimGpt(gcpIt->second[1], gcpIt->second[0], gcpIt->second[2]); - - // Add the sensor point to the list - sensorPoints.push_back(sensorPoint); - - // Add the geo point to the list - geoPoints.push_back(geoPoint); - } + // Fill sensor point + sensorPoint = ossimDpt(gcpIt->first[0], gcpIt->first[1]); + + // Fill geo point (lat, lon, elev) + geoPoint = ossimGpt(gcpIt->second[1], gcpIt->second[0], gcpIt->second[2]); + + // Add the sensor point to the list + sensorPoints.push_back(sensorPoint); + + // Add the geo point to the list + geoPoints.push_back(geoPoint); } // Check for enough points @@ -99,8 +93,6 @@ RPCSolverAdapter::Solve(const GCPsContainerType& gcpContainer, } bool RPCSolverAdapter::Solve(const GCPsContainerType& gcpContainer, - const Point2DType& ulImagePoint, - const Point2DType& lrImagePoint, double& rmsError, const std::string & outgeom) { @@ -108,7 +100,7 @@ bool RPCSolverAdapter::Solve(const GCPsContainerType& gcpContainer, ImageKeywordlist otb_kwl; // Call the Solve method that actually does the solving - Solve(gcpContainer,ulImagePoint,lrImagePoint,rmsError,otb_kwl); + Solve(gcpContainer,rmsError,otb_kwl); // Write the keywordlist to disk ossimKeywordlist kwl; diff --git a/Code/UtilitiesAdapters/OssimAdapters/otbRPCSolverAdapter.h b/Code/UtilitiesAdapters/OssimAdapters/otbRPCSolverAdapter.h index 7f9efa1d269c0d6bb101ffe752199e817a102700..3a67d8796455c57ed6d646b7263ef55c9eebe0b4 100644 --- a/Code/UtilitiesAdapters/OssimAdapters/otbRPCSolverAdapter.h +++ b/Code/UtilitiesAdapters/OssimAdapters/otbRPCSolverAdapter.h @@ -56,8 +56,6 @@ public: * by other OTB and classes (like GenericRSTransform for instance). */ static void Solve(const GCPsContainerType& gcpContainer, - const Point2DType& ulImagePoint, - const Point2DType& lrImagePoint, double& rmsError, ImageKeywordlist& otb_kwl); @@ -65,8 +63,6 @@ public: * estimated RPC model is written to a geom file */ static bool Solve(const GCPsContainerType& gcpContainer, - const Point2DType& ulImagePoint, - const Point2DType& lrImagePoint, double& rmsError, const std::string & outgeom); diff --git a/Testing/Code/UtilitiesAdapters/otbRPCSolverAdapterTest.cxx b/Testing/Code/UtilitiesAdapters/otbRPCSolverAdapterTest.cxx index 2d67d8260884a78fe4833178a6fb6d91d55b774e..8f005ceb331dd5b0b4b40a873420af54aaf1aed8 100644 --- a/Testing/Code/UtilitiesAdapters/otbRPCSolverAdapterTest.cxx +++ b/Testing/Code/UtilitiesAdapters/otbRPCSolverAdapterTest.cxx @@ -102,23 +102,18 @@ int otbRPCSolverAdapterTest(int argc, char* argv[]) otb::ImageKeywordlist rpcKwl; double rmse; - Point2DType ul = reader->GetOutput()->GetOrigin(); - Point2DType lr; - lr[0] = ul[0] + size[0]*reader->GetOutput()->GetSpacing()[0]; - lr[1] = ul[1] + size[1]*reader->GetOutput()->GetSpacing()[1]; - - // Call solver: either write geom and exit, or evaluate model precision + // Call solver: either write geom and exit, or evaluate model precision if(argc==8) { const std::string outgeom = argv[7]; - bool success = otb::RPCSolverAdapter::Solve(gcps,ul,lr,rmse,outgeom); + bool success = otb::RPCSolverAdapter::Solve(gcps,rmse,outgeom); if(success) return EXIT_SUCCESS; else return EXIT_FAILURE; } - otb::RPCSolverAdapter::Solve(gcps,ul,lr,rmse,rpcKwl); + otb::RPCSolverAdapter::Solve(gcps,rmse,rpcKwl); std::cout<<"Optimization done, RMSE="<<rmse<<std::endl;