Skip to content
Snippets Groups Projects
Commit 903d3079 authored by Caroline Ruffel's avatar Caroline Ruffel
Browse files

nomsg

parent 020b10ac
No related branches found
No related tags found
No related merge requests found
/*=========================================================================
Programme : OTB (ORFEO ToolBox)
Auteurs : CS - C.Ruffel
Language : C++
Date : 14 mars 2006
Version :
Role : Test du filtre de detection de lignes par correlation
$Id$
=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#define MAIN
#include "itkExceptionObject.h"
#include "itkImage.h"
#include "itkImageFileWriter.h"
#include <iostream>
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "otbLineCorrelationDetector.h"
#include "itkLinearInterpolateImageFunction.h"
int otbLineCorrelationDetectorLinear( int argc, char* argv[] )
{
try
{
const char * inputFilename = argv[1];
const char * outputFilename = argv[2];
// Largeur de la ligne detecter = 2*WidthLine+1
unsigned int WidthLine((unsigned int)::atoi(argv[3]));
// Longueur de la ligne detecter = 2*LengthLine+1
unsigned int LengthLine((unsigned int)::atoi(argv[4]));
typedef unsigned char InputPixelType;
typedef double OutputPixelType;
const unsigned int Dimension = 2;
typedef itk::Image< InputPixelType, Dimension > InputImageType;
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
typedef otb::ImageFileReader< InputImageType > ReaderType;
typedef otb::ImageFileWriter< OutputImageType > WriterType;
typedef itk::LinearInterpolateImageFunction< InputImageType, double > InterpolatorType;
typedef otb::LineCorrelationDetector< InputImageType, OutputImageType, InterpolatorType > FilterType;
FilterType::Pointer FilterLineCorrelation = FilterType::New();
FilterLineCorrelation->SetWidthLine( WidthLine );
FilterLineCorrelation->SetLengthLine( LengthLine );
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName( inputFilename );
writer->SetFileName( outputFilename );
FilterLineCorrelation->SetInput( reader->GetOutput() );
writer->SetInput( FilterLineCorrelation->GetOutput() );
writer->Update();
}
catch( itk::ExceptionObject & err )
{
std::cout << "Exception itk::ExceptionObject levee !" << std::endl;
std::cout << err << std::endl;
return EXIT_FAILURE;
}
catch( ... )
{
std::cout << "Exception levee inconnue !" << std::endl;
return EXIT_FAILURE;
}
// Software Guide : EndCodeSnippet
//#endif
return EXIT_SUCCESS;
}
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