From e825a1e89a6789c3c6968ba9199a5f5d5f47c16d Mon Sep 17 00:00:00 2001 From: Manuel Grizonnet <manuel.grizonnet@gmail.com> Date: Mon, 18 Jan 2010 15:31:21 +0100 Subject: [PATCH] DOC:estimate affine transfo with sift --- Examples/DisparityMap/CMakeLists.txt | 3 +- .../EstimateAffineTransformationExample.cxx | 37 +++++++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/Examples/DisparityMap/CMakeLists.txt b/Examples/DisparityMap/CMakeLists.txt index 61f10cfba2..0611cc3da8 100755 --- a/Examples/DisparityMap/CMakeLists.txt +++ b/Examples/DisparityMap/CMakeLists.txt @@ -51,9 +51,10 @@ ADD_TEST(dmTeEstimateAffineTransformationExampleTest ${EXE_TESTS} ${TEMP}/AffineTransformationOutput.png EstimateAffineTransformationExampleTest ${INPUTDATA}/QB_Suburb.png - ${INPUTDATA}/QB_Suburb13x17y.png + ${INPUTDATA}/QB_SuburbR10X13Y17.png ${TEMP}/AffineTransformationOutput.png 2 3 0 0 0.5 1 + ${TEMP}/AffineTransformationTxtOutput.txt ) INCLUDE_DIRECTORIES(${OTB_SOURCE_DIR}/Testing/Code) diff --git a/Examples/DisparityMap/EstimateAffineTransformationExample.cxx b/Examples/DisparityMap/EstimateAffineTransformationExample.cxx index 10a6edbe5d..99fa08837e 100755 --- a/Examples/DisparityMap/EstimateAffineTransformationExample.cxx +++ b/Examples/DisparityMap/EstimateAffineTransformationExample.cxx @@ -24,8 +24,8 @@ #endif // Software Guide : BeginCommandLineArgs -// INPUTS: {ROISpot5.png}, {ROISpot5Moving.png} -// OUTPUTS: {SIFTResampling.png} +// INPUTS: {QB_Suburb.png}, {QB_SuburbR10X13Y17.png} +// OUTPUTS: {AffineTransformationOutput.png} // Software Guide : EndCommandLineArgs // Software Guide : BeginLatex @@ -75,10 +75,10 @@ int main (int argc, char* argv[]) { - if (argc!= 10) + if (argc!= 11) { std::cerr <<"Usage: "<<argv[0]; - std::cerr<<"fixedFileName movingFileName resamplingImageFileName octaves scales threshold ratio secondOrderThreshold useBackMatching" << std::endl; + std::cerr<<"fixedFileName movingFileName resamplingImageFileName octaves scales threshold ratio secondOrderThreshold useBackMatching transfofname" << std::endl; return EXIT_FAILURE; } @@ -92,6 +92,8 @@ int main (int argc, char* argv[]) float ratio = atof(argv[7]); const double secondOrderThreshold = atof(argv[8]); const bool useBackMatching = atoi(argv[9]); + const char * outputTransformationFilename = argv[10]; + const unsigned int Dimension = 2; // Software Guide : BeginLatex @@ -359,7 +361,7 @@ int main (int argc, char* argv[]) // Write the transformation to a file std::ofstream ofs; - ofs.open("transfo.txt"); + ofs.open(outputTransformationFilename); // Set floatfield to format properly ofs.setf(std::ios::fixed, std::ios::floatfield); @@ -391,16 +393,37 @@ int main (int argc, char* argv[]) // Software Guide : BeginLatex // - // Write resampled image + // Write resampled image to png // // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet typedef otb::ImageFileWriter< OutputImageType > WriterType; WriterType::Pointer writer = WriterType::New(); writer->SetInput( resampler->GetOutput() ); writer->SetFileName( outputImageFilename ); writer->Update(); - + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // Figure~\ref{fig:SIFTDME} shows the result of the resampled image using the + // estimated transformation based on SIFT points + // + // \begin{figure} + // \center + // \includegraphics[width=0.40\textwidth]{QB_Suburb.eps} + // \includegraphics[width=0.40\textwidth]{QB_SuburbR10X13Y17.eps} + // \includegraphics[width=0.40\textwidth]{AffineTransformationOutput.eps} + // \itkcaption[Estimation of affine transformation from SIFT ]{From left + // to right and top to bottom: fixed input image, moving image, + // resampled moving image.} + // \label{fig:SIFTDME} + // \end{figure} + // + // Software Guide : EndLatex + return EXIT_SUCCESS; } -- GitLab