DGtal 1.3.0
Loading...
Searching...
No Matches
Functions
exampleRigidtransformation2d.cpp File Reference
#include <iostream>
#include <cmath>
#include "DGtal/images/ImageSelector.h"
#include "DGtal/images/ImageContainerBySTLVector.h"
#include "DGtal/images/ConstImageAdapter.h"
#include "ConfigExamples.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/base/Common.h"
#include "DGtal/io/readers/PGMReader.h"
#include "DGtal/io/writers/GenericWriter.h"
#include "DGtal/images/RigidTransformation2D.h"

Go to the source code of this file.

Functions

int main (int, char **)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Kacper Pluta (kacpe.nosp@m.r.pl.nosp@m.uta@e.nosp@m.siee.nosp@m..fr ) Laboratoire d'Informatique Gaspard-Monge - LIGM, France
Date
2014/06/28

An example file named rigidtransformation2d.

This file is part of the DGtal library.

Definition in file exampleRigidtransformation2d.cpp.

Function Documentation

◆ main()

int main ( int  ,
char **   
)

[def]

[def]

[trans]

[trans] [init_domain_helper]

[init_domain_helper]

[domain]

[domain]

[backward]

[backward]

[forward]

[forward]

Definition at line 61 of file exampleRigidtransformation2d.cpp.

62{
65 typedef ForwardRigidTransformation2D < Space > ForwardTrans;
66 typedef BackwardRigidTransformation2D < Space > BackwardTrans;
68 typedef DomainRigidTransformation2D < Domain, ForwardTrans > MyDomainTransformer;
69 typedef MyDomainTransformer::Bounds Bounds;
71 trace.beginBlock ( "Example rigidtransformation2d" );
73 ForwardTrans forwardTrans( RealPoint ( 5, 5 ), M_PI_4, RealVector( 3, -3 ) );
74 BackwardTrans backwardTrans( RealPoint ( 5, 5 ), M_PI_4, RealVector( 3, -3 ) );
77 MyDomainTransformer domainTransformer ( forwardTrans );
79 Identity idD;
80
81 Image image = PGMReader<Image>::importPGM ( examplesPath + "samples/church.pgm" );
83 Bounds bounds = domainTransformer ( image.domain() );
84 Domain transformedDomain ( bounds.first, bounds.second );
86
87 trace.beginBlock ( "Backward - Eulerian model" );
89 MyImageBackwardAdapter backwardImageAdapter ( image, transformedDomain , backwardTrans, idD );
91 backwardImageAdapter >> "backward_transform.pgm";
93
94 trace.beginBlock( "Forward - Lagrangian model" );
95 Image forwardTransformedImage ( transformedDomain );
97 for ( Domain::ConstIterator it = image.domain().begin(); it != image.domain().end(); ++it )
98 {
99 forwardTransformedImage.setValue ( forwardTrans ( *it ), image ( *it ) );
100 }
102 forwardTransformedImage >> "forward_transform.pgm";
103 trace.endBlock();
104 trace.endBlock();
105 return 0;
106}
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
Iterator for HyperRectDomain.
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:70
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
void beginBlock(const std::string &keyword="")
double endBlock()
Space::RealVector RealVector
Definition: StdDefs.h:98
Trace trace
Definition: Common.h:154
static ImageContainer importPGM(const std::string &aFilename, const Functor &aFunctor=Functor(), bool topbotomOrder=true)
Aim: Define a simple default functor that just returns its argument.

References DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::PGMReader< TImageContainer, TFunctor >::importPGM(), DGtal::Image< TImageContainer >::setValue(), and DGtal::trace.