Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine Belvire
otb
Commits
518b9b1f
Commit
518b9b1f
authored
16 years ago
by
Emmanuel Christophe
Browse files
Options
Downloads
Patches
Plain Diff
DOC: Software guide comments for NCC
parent
ac177b33
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Examples/DisparityMap/NCCRegistrationFilterExample.cxx
+85
-8
85 additions, 8 deletions
Examples/DisparityMap/NCCRegistrationFilterExample.cxx
with
85 additions
and
8 deletions
Examples/DisparityMap/NCCRegistrationFilterExample.cxx
+
85
−
8
View file @
518b9b1f
...
...
@@ -31,13 +31,24 @@
// Software Guide : EndCommandLineArgs
// Software Guide : BeginLatex
//
// This example demonstrates the use of the \doxygen{otb}{NCCRegistrationFilter}. This filter performs deformation estimation
// by optimising a PDE based on correlation. This use the finite difference solver hierarchy.
//
// The first step toward the use of these filters is to include the proper header files.
//
// Software Guide : EndLatex
#include
"otbImage.h"
#include
"otbImageFileWriter.h"
#include
"otbImageFileReader.h"
#include
"otbNCCRegistrationFilter.h"
#include
"otbCommandLineArgumentParser.h"
// Software Guide : BeginCodeSnippet
#include
"otbNCCRegistrationFilter.h"
#include
"itkRecursiveGaussianImageFilter.h"
// Software Guide : EndCodeSnippet
#include
<iostream>
...
...
@@ -52,11 +63,21 @@ int main(int argc, char** argv )
typedef
double
CoordinateRepresentationType
;
// Software Guide : BeginLatex
//
// Several type of \doxygen{otb}{Image} are required to represent the reference image (fixed)
// the image we want to register (moving) and the deformation field.
//
// Software Guide : EndLatex
//Allocate Images
// Software Guide : BeginCodeSnippet
typedef
otb
::
Image
<
PixelType
,
ImageDimension
>
MovingImageType
;
typedef
otb
::
Image
<
PixelType
,
ImageDimension
>
FixedImageType
;
typedef
otb
::
Image
<
DeformationPixelType
,
ImageDimension
>
DeformationFieldType
;
// Software Guide : EndCodeSnippet
typedef
otb
::
ImageFileReader
<
FixedImageType
>
FixedReaderType
;
FixedReaderType
::
Pointer
fReader
=
FixedReaderType
::
New
();
...
...
@@ -67,8 +88,16 @@ int main(int argc, char** argv )
mReader
->
SetFileName
(
argv
[
2
]);
//Blur input images
// Software Guide : BeginLatex
//
// To make the correlation possible and to avoid some local minima the first required step is
// to blur the input images. This is done using the \doxygen{itk}{RecursiveGaussianImageFilter}:
//
// Software Guide : EndLatex
//Blur input images
// Software Guide : BeginCodeSnippet
typedef
itk
::
RecursiveGaussianImageFilter
<
FixedImageType
,
FixedImageType
>
FixedBlurType
;
...
...
@@ -83,9 +112,16 @@ int main(int argc, char** argv )
MovingBlurType
::
Pointer
mBlur
=
MovingBlurType
::
New
();
mBlur
->
SetInput
(
mReader
->
GetOutput
()
);
mBlur
->
SetSigma
(
atof
(
argv
[
5
])
);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// Now, we need to instanciate the NCCRegistrationFilter which is going to perform the registration:
//
// Software Guide : EndLatex
//Create the filter
// Software Guide : BeginCodeSnippet
typedef
otb
::
NCCRegistrationFilter
<
FixedImageType
,
MovingImageType
,
DeformationFieldType
>
...
...
@@ -95,8 +131,17 @@ int main(int argc, char** argv )
registrator
->
SetMovingImage
(
mBlur
->
GetOutput
()
);
registrator
->
SetFixedImage
(
fBlur
->
GetOutput
()
);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// Few parameters need to be specified to the NCCRegistrationFilter:
// \begin{itemize}
// \item The area where the search is performed. This area is defined by its radius:
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef
RegistrationFilterType
::
RadiusType
RadiusType
;
RadiusType
radius
;
...
...
@@ -105,16 +150,31 @@ int main(int argc, char** argv )
radius
[
1
]
=
atoi
(
argv
[
4
]);
registrator
->
SetNCCRadius
(
radius
);
// Software Guide : EndCodeSnippet
std
::
cout
<<
"NCC radius "
<<
registrator
->
GetNCCRadius
()
<<
std
::
endl
;
// Software Guide : BeginLatex
//
// \item The number of iteration for the PDE resolution:
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
registrator
->
SetNumberOfIterations
(
atoi
(
argv
[
6
])
);
// Software Guide : EndCodeSnippet
// registrator->GetDeformationField();
// Software Guide : BeginLatex
//
// \end{itemize}
// Then we can trigger the \code{Update()} method on the NCCRegistrationFilter:
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
registrator
->
Update
();
// Software Guide : EndCodeSnippet
typedef
otb
::
ImageFileWriter
<
DeformationFieldType
>
DFWriterType
;
...
...
@@ -124,6 +184,23 @@ int main(int argc, char** argv )
dfWriter
->
SetInput
(
registrator
->
GetOutput
()
);
dfWriter
->
Update
();
// Software Guide : BeginLatex
//
// Figure~\ref{fig:NCCRegistrationFilterOUTPUT} shows the result of applying.
//
// \begin{figure}
// \center
// \includegraphics[width=0.40\textwidth]{}
// \includegraphics[width=0.40\textwidth]{}
// \includegraphics[width=0.40\textwidth]{}
// \includegraphics[width=0.40\textwidth]{}
// \itkcaption[Deformation field and resampling from NCC registration]{From left
// to right and top to bottom: fixed input image, moving image with a low stereo angle,
// estimated deformation field in the horizontal direction, resampled moving image.}
// \label{fig:NCCRegistrationFilterOUTPUT}
// \end{figure}
//
// Software Guide : EndLatex
return
EXIT_SUCCESS
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment