diff --git a/Code/Projections/otbGCPsToRPCSensorModelImageFilter.h b/Code/Projections/otbGCPsToRPCSensorModelImageFilter.h index 1351c44ac78b5262f6a616a4c9720f5b58e755ba..8f83a204f299db3a5a48c7255fc12e109d5c29f7 100644 --- a/Code/Projections/otbGCPsToRPCSensorModelImageFilter.h +++ b/Code/Projections/otbGCPsToRPCSensorModelImageFilter.h @@ -212,9 +212,6 @@ private: /** RPC Projection */ ossimRefPtr<ossimRpcProjection> m_RpcProjection; - /** Projection */ - ossimRefPtr<ossimProjection> m_Projection; - /** Keywordlist */ ImageKeywordlist m_Keywordlist; diff --git a/Code/Projections/otbGCPsToRPCSensorModelImageFilter.txx b/Code/Projections/otbGCPsToRPCSensorModelImageFilter.txx index 31f7a925544af010806f46e21377e99a3da6984a..17850ed3fcfaa9f9f3de810f1a66a49e29ffbf21 100644 --- a/Code/Projections/otbGCPsToRPCSensorModelImageFilter.txx +++ b/Code/Projections/otbGCPsToRPCSensorModelImageFilter.txx @@ -37,8 +37,7 @@ GCPsToRPCSensorModelImageFilter<TImage> m_MeanElevation(0.), m_DEMHandler(), m_GCPsContainer(), - m_RpcProjection(), - m_Projection() + m_RpcProjection() { // This filter does not modify the image buffer, but only its // metadata.Therefore, it can be run inplace to reduce memory print. @@ -114,8 +113,8 @@ GCPsToRPCSensorModelImageFilter<TImage> // Create the ground point with elevation Point3DType groundPointWithElevation; // Fill it with ground point data - groundPointWithElevation[0] = groundPoint[0]; - groundPointWithElevation[1] = groundPoint[1]; + groundPointWithElevation[1] = groundPoint[0]; + groundPointWithElevation[0] = groundPoint[1]; // Check wether we are using a DEM or not if (m_UseDEM) @@ -233,12 +232,12 @@ GCPsToRPCSensorModelImageFilter<TImage> gpoint.hgt = height; - if (m_Projection != NULL) + if (m_RpcProjection != NULL) { - m_Projection->lineSampleToWorld(spoint, gpoint); + m_RpcProjection->lineSampleToWorld(spoint, gpoint); - groundPoint[0] = gpoint.lon; - groundPoint[1] = gpoint.lat; + groundPoint[1] = gpoint.lon; + groundPoint[0] = gpoint.lat; groundPoint[2] = gpoint.hgt; } else @@ -288,17 +287,15 @@ GCPsToRPCSensorModelImageFilter<TImage> idTrans3D[1] = groundPointTemp[1]; idTrans3D[2] = groundPointTemp[2]; - double distance = idOut3D.EuclideanDistanceTo(idTrans3D); - double error = vcl_sqrt(distance); + double error = idOut3D.EuclideanDistanceTo(idTrans3D); // Add error to the container m_ErrorsContainer.push_back(error); // Compute mean error - sum += distance; + sum += error; } - sum = vcl_sqrt(sum); m_MeanError = sum / static_cast<double>(m_ErrorsContainer.size()); } @@ -339,7 +336,7 @@ GCPsToRPCSensorModelImageFilter<TImage> } // Build the ossim rpc solver - ossimRefPtr<ossimRpcSolver> rpcSolver = new ossimRpcSolver(false, false); + ossimRefPtr<ossimRpcSolver> rpcSolver = new ossimRpcSolver(true, false); // Call the solve method rpcSolver->solveCoefficients(sensorPoints, geoPoints); @@ -355,14 +352,11 @@ GCPsToRPCSensorModelImageFilter<TImage> rpcModel->saveState(geom_kwl); // Compute projection - ossimRefPtr<ossimRpcProjection> objp = dynamic_cast<ossimRpcProjection*>( + m_RpcProjection = dynamic_cast<ossimRpcProjection*>( rpcSolver->createRpcProjection()->getProjection()); ossimKeywordlist kwl; - objp->saveState(kwl); - m_RpcProjection->loadState(kwl); - m_Projection = m_RpcProjection.get(); - - // Compute errors + m_RpcProjection->saveState(kwl); + // Compute errors this->ComputeErrors(); // Build an otb::ImageKeywordList