Skip to content
Snippets Groups Projects
Commit 779c9818 authored by Manuel Grizonnet's avatar Manuel Grizonnet
Browse files

DOC:update affine transformation with lesat square example

parent 62e650f0
No related branches found
No related tags found
No related merge requests found
...@@ -140,7 +140,7 @@ int main (int argc, char* argv[]) ...@@ -140,7 +140,7 @@ int main (int argc, char* argv[])
ImageToSIFTKeyPointSetFilterType; ImageToSIFTKeyPointSetFilterType;
// Software Guide : EndCodeSnippet // Software Guide : EndCodeSnippet
// Software Guide : BeginLatex // Software Guide : BeginLatex
// //
// Although many choices for evaluating the distances during the // Although many choices for evaluating the distances during the
// matching procedure exist, we choose here to use a simple // matching procedure exist, we choose here to use a simple
...@@ -245,8 +245,7 @@ int main (int argc, char* argv[]) ...@@ -245,8 +245,7 @@ int main (int argc, char* argv[])
filter2->SetDoGThreshold(threshold); filter2->SetDoGThreshold(threshold);
filter2->SetEdgeThreshold(ratio); filter2->SetEdgeThreshold(ratio);
// Software Guide : EndCodeSnippet // Software Guide : EndCodeSnippet
// Software Guide : BeginLatex // Software Guide : BeginLatex
// //
...@@ -262,7 +261,7 @@ int main (int argc, char* argv[]) ...@@ -262,7 +261,7 @@ int main (int argc, char* argv[])
euclideanMatcher->SetDistanceThreshold(secondOrderThreshold); euclideanMatcher->SetDistanceThreshold(secondOrderThreshold);
euclideanMatcher->SetUseBackMatching(useBackMatching); euclideanMatcher->SetUseBackMatching(useBackMatching);
//std::cout << "Update euclidian distance" << std::endl;
euclideanMatcher->Update(); euclideanMatcher->Update();
// Software Guide : EndCodeSnippet // Software Guide : EndCodeSnippet
...@@ -279,7 +278,7 @@ int main (int argc, char* argv[]) ...@@ -279,7 +278,7 @@ int main (int argc, char* argv[])
LandmarkListType::Pointer landmarkList; LandmarkListType::Pointer landmarkList;
landmarkList = euclideanMatcher->GetOutput(); landmarkList = euclideanMatcher->GetOutput();
//std::cout << "Get landmarkList" << std::endl;
// Software Guide : EndCodeSnippet // Software Guide : EndCodeSnippet
// Software Guide : BeginLatex // Software Guide : BeginLatex
...@@ -287,11 +286,12 @@ int main (int argc, char* argv[]) ...@@ -287,11 +286,12 @@ int main (int argc, char* argv[])
// Apply Mean square algorithm // Apply Mean square algorithm
// //
// Software Guide : EndLatex // Software Guide : EndLatex
// Software Guide : BeginCodeSnippet // Software Guide : BeginCodeSnippet
typedef itk::Point<double,2> MyPointType; typedef itk::Point<double,2> MyPointType;
typedef otb::LeastSquareAffineTransformEstimator<MyPointType> EstimatorType; typedef otb::LeastSquareAffineTransformEstimator<MyPointType> EstimatorType;
// instantiation // instantiation of the estimator of the affine transformation
EstimatorType::Pointer estimator = EstimatorType::New(); EstimatorType::Pointer estimator = EstimatorType::New();
std::cout << "landmark list size " << landmarkList->Size() << std::endl; std::cout << "landmark list size " << landmarkList->Size() << std::endl;
for (LandmarkListType::Iterator it = landmarkList->Begin(); for (LandmarkListType::Iterator it = landmarkList->Begin();
...@@ -303,7 +303,7 @@ int main (int argc, char* argv[]) ...@@ -303,7 +303,7 @@ int main (int argc, char* argv[])
// Trigger computation // Trigger computation
estimator->Compute(); estimator->Compute();
// Software Guide : EndCodeSnippet // Software Guide : EndCodeSnippet
// Software Guide : BeginLatex // Software Guide : BeginLatex
// //
...@@ -316,10 +316,7 @@ int main (int argc, char* argv[]) ...@@ -316,10 +316,7 @@ int main (int argc, char* argv[])
// the resulting transform to map the moving image into the fixed // the resulting transform to map the moving image into the fixed
// image space. This is easily done with the // image space. This is easily done with the
// \doxygen{itk}{ResampleImageFilter}. First, a ResampleImageFilter // \doxygen{itk}{ResampleImageFilter}. First, a ResampleImageFilter
// type is instantiated using the image types. It is convenient to // type is instantiated using the image types.
// use the fixed image type as the output type since it is likely
// that the transformed moving image will be compared with the
// fixed image.
// //
// Software Guide : EndLatex // Software Guide : EndLatex
...@@ -340,20 +337,13 @@ int main (int argc, char* argv[]) ...@@ -340,20 +337,13 @@ int main (int argc, char* argv[])
ResampleFilterType::Pointer resampler = ResampleFilterType::New(); ResampleFilterType::Pointer resampler = ResampleFilterType::New();
resampler->SetInput( movingReader->GetOutput() ); resampler->SetInput( movingReader->GetOutput() );
//typedef itk::ImageRegistrationMethod<
//ImageType,
//ImageType > RegistrationType;
//RegistrationType::Pointer registration = RegistrationType::New();
// Software Guide : EndCodeSnippet // Software Guide : EndCodeSnippet
// Software Guide : BeginLatex // Software Guide : BeginLatex
// //
// The Transform that is produced as output need to be inversed to // The Transform that is produced as output do not need to be inversed because
// We apply here the resampling algorithm to the "fixed" image // we apply here the resampling algorithm to the "moving" image
// to produce the moving image. Or apply to the moving image // to produce the fixed image.
//
// //
// Software Guide : EndLatex // Software Guide : EndLatex
...@@ -364,7 +354,7 @@ int main (int argc, char* argv[]) ...@@ -364,7 +354,7 @@ int main (int argc, char* argv[])
// Set floatfield to format properly // Set floatfield to format properly
ofs.setf(std::ios::fixed, std::ios::floatfield); ofs.setf(std::ios::fixed, std::ios::floatfield);
ofs.precision(10); ofs.precision(10);
ofs<<"Transformation"<<std::endl;
ofs<<"Estimated affine matrix: "<<std::endl; ofs<<"Estimated affine matrix: "<<std::endl;
ofs<<estimator->GetMatrix()<<std::endl; ofs<<estimator->GetMatrix()<<std::endl;
ofs<<"Estimated affine offset: "<<std::endl; ofs<<"Estimated affine offset: "<<std::endl;
...@@ -373,18 +363,16 @@ int main (int argc, char* argv[]) ...@@ -373,18 +363,16 @@ int main (int argc, char* argv[])
ofs<<estimator->GetRMSError()<<std::endl; ofs<<estimator->GetRMSError()<<std::endl;
ofs<<"Relative residual: "<<std::endl; ofs<<"Relative residual: "<<std::endl;
ofs<<estimator->GetRelativeResidual()<<std::endl; ofs<<estimator->GetRelativeResidual()<<std::endl;
ofs.close(); ofs.close();
// Software Guide : BeginCodeSnippet // Software Guide : BeginCodeSnippet
// Get the output transform
typedef EstimatorType::AffineTransformType AffineTransformType;
AffineTransformType::Pointer transform = AffineTransformType::New();
transform->GetInverse( estimator->GetAffineTransform() );
resampler->SetTransform( transform ); ImageType::Pointer fixedImage = fixedReader->GetOutput();
resampler->SetSize( fixedReader->GetOutput()->GetLargestPossibleRegion().GetSize() );
resampler->SetOutputOrigin( fixedReader->GetOutput()->GetOrigin() ); resampler->SetTransform( estimator->GetAffineTransform() );
resampler->SetOutputSpacing( fixedReader->GetOutput()->GetSpacing() ); resampler->SetSize( fixedImage->GetLargestPossibleRegion().GetSize() );
resampler->SetOutputOrigin( fixedImage->GetOrigin() );
resampler->SetOutputSpacing( fixedImage->GetSpacing() );
resampler->SetDefaultPixelValue( 100 ); resampler->SetDefaultPixelValue( 100 );
// Software Guide : EndCodeSnippet // Software Guide : EndCodeSnippet
...@@ -414,7 +402,7 @@ int main (int argc, char* argv[]) ...@@ -414,7 +402,7 @@ int main (int argc, char* argv[])
// \includegraphics[width=0.40\textwidth]{QB_Suburb.eps} // \includegraphics[width=0.40\textwidth]{QB_Suburb.eps}
// \includegraphics[width=0.40\textwidth]{QB_SuburbR10X13Y17.eps} // \includegraphics[width=0.40\textwidth]{QB_SuburbR10X13Y17.eps}
// \includegraphics[width=0.40\textwidth]{AffineTransformationOutput.eps} // \includegraphics[width=0.40\textwidth]{AffineTransformationOutput.eps}
// \itkcaption[Estimation of affine transformation from SIFT ]{From left // \itkcaption[Estimation of affine transformation using least square optimisation from SIFT points]{From left
// to right and top to bottom: fixed input image, moving image, // to right and top to bottom: fixed input image, moving image,
// resampled moving image.} // resampled moving image.}
// \label{fig:SIFTDME} // \label{fig:SIFTDME}
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
=========================================================================*/ =========================================================================*/
// Software Guide : BeginCommandLineArgs // Software Guide : BeginCommandLineArgs
// INPUTS: {qb_RoadExtract2.tif} // INPUTS: {qb_RoadExtract.tif}
// OUTPUTS: {OBIARadiometricAttribute1.tif} // OUTPUTS: {OBIARadiometricAttribute1.tif}
// STATS::Ndvi::Mean 0 -0.3 16 16 10 1.0 // STATS::Ndvi::Mean 0 -0.3 16 16 100 1.0
// Software Guide : EndCommandLineArgs // Software Guide : EndCommandLineArgs
// Software Guide : BeginLatex // Software Guide : BeginLatex
...@@ -243,7 +243,7 @@ int main(int argc, char * argv[]) ...@@ -243,7 +243,7 @@ int main(int argc, char * argv[])
// Figure~\ref{fig:RADIOMETRIC_LABEL_MAP_FILTER} shows the result of applying // Figure~\ref{fig:RADIOMETRIC_LABEL_MAP_FILTER} shows the result of applying
// the object selection based on radiometric attributes. // the object selection based on radiometric attributes.
// \begin{figure} \center // \begin{figure} \center
// \includegraphics[width=0.44\textwidth]{qb_RoadExtract2.eps} // \includegraphics[width=0.44\textwidth]{qb_RoadExtract.eps}
// \includegraphics[width=0.44\textwidth]{OBIARadiometricAttribute1.eps} // \includegraphics[width=0.44\textwidth]{OBIARadiometricAttribute1.eps}
// \itkcaption[Object based extraction based on ]{From left to right : original image, vegetation mask resulting from processing.} // \itkcaption[Object based extraction based on ]{From left to right : original image, vegetation mask resulting from processing.}
// \label{fig:RADIOMETRIC_LABEL_MAP_FILTER} // \label{fig:RADIOMETRIC_LABEL_MAP_FILTER}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment