18 #ifndef __otbPhysicalToRPCSensorModelImageFilter_txx
19 #define __otbPhysicalToRPCSensorModelImageFilter_txx
26 template <
class TImage>
36 m_GCPsToSensorModelFilter = GCPsToSensorModelType::New();
43 m_OutputInformationGenerated =
false;
46 template <
class TImage>
52 template <
class TImage>
57 Superclass::GenerateOutputInformation();
59 if(!m_OutputInformationGenerated)
68 rsTransform->SetInputKeywordList(input->GetImageKeywordlist());
69 rsTransform->InstanciateTransform();
72 typename ImageType::SizeType size = input->GetLargestPossibleRegion().GetSize();
73 double gridSpacingX = size[0]/m_GridSize[0];
74 double gridSpacingY = size[1]/m_GridSize[1];
76 for(
unsigned int px = 0; px<m_GridSize[0]; ++px)
78 for(
unsigned int py = 0; py<m_GridSize[1]; ++py)
80 PointType inputPoint = input->GetOrigin();
81 inputPoint[0] += (px * gridSpacingX + 0.5) * input->GetSpacing()[0];
82 inputPoint[1] += (py * gridSpacingY + 0.5) * input->GetSpacing()[1];
83 PointType outputPoint = rsTransform->TransformPoint(inputPoint);
84 m_GCPsToSensorModelFilter->AddGCP(inputPoint, outputPoint);
88 m_GCPsToSensorModelFilter->SetInput(input);
89 m_GCPsToSensorModelFilter->UpdateOutputInformation();
91 otbGenericMsgDebugMacro(<<
"RPC model estimated. RMS ground error: "<<m_GCPsToSensorModelFilter->GetRMSGroundError()
92 <<
", Mean error: "<<m_GCPsToSensorModelFilter->GetMeanError());
97 m_GCPsToSensorModelFilter->GetKeywordlist());
100 m_OutputInformationGenerated =
true;
104 template <
class TImage>
109 Superclass::Modified();
110 m_OutputInformationGenerated=
false;
113 template <
class TImage>
118 Superclass::PrintSelf(os, indent);