Skip to content
Snippets Groups Projects
Commit 85d66e5f authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

Ajout tests pour le pan sharpening

parent aeb3d3ad
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,20 @@ ADD_TEST(fuTvBayesianFusionFilter ${FUSION_TESTS}
)
# ------- otb::SimpleRcsPanSharpeningFusionImageFilter -------------------
ADD_TEST(fuTuSimpleRcsPanSharpeningFusionImageFilterNew ${FUSION_TESTS}
otbSimpleRcsPanSharpeningFusionImageFilterNew
)
ADD_TEST(fuTvSimpleRcsPanSharpeningFusionImageFilter ${FUSION_TESTS}
--compare-image ${TOL} ${BASELINE}/fuTvRcsPanSharpeningFusion.tif
${TEMP}/fuTvRcsPanSharpeningFusion.tif
otbSimpleRcsPanSharpeningFusionImageFilter
${INPUTDATA}/QB_Toulouse_Ortho_PAN.tif
${INPUTDATA}/QB_Toulouse_Ortho_XS.tif
${TEMP}/fuTvRcsPanSharpeningFusion.tif
)
# A enrichir
......@@ -48,6 +62,8 @@ SET(Fusion_SRCS
otbFusionImageBaseNew.cxx
otbBayesianFusionFilterNew.cxx
otbBayesianFusionFilter.cxx
otbSimpleRcsPanSharpeningFusionImageFilterNew.cxx
otbSimpleRcsPanSharpeningFusionImageFilter.cxx
)
......
......@@ -31,4 +31,6 @@ void RegisterTests()
REGISTER_TEST(otbBayesianFusionFilterNew);
REGISTER_TEST(otbBayesianFusionFilter);
REGISTER_TEST(otbFusionImageBaseNew);
REGISTER_TEST(otbSimpleRcsPanSharpeningFusionImageFilterNew);
REGISTER_TEST(otbSimpleRcsPanSharpeningFusionImageFilter);
}
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "itkExceptionObject.h"
#include "otbImageFileReader.h"
#include "otbStreamingImageFileWriter.h"
#include "otbVectorImage.h"
#include "otbImage.h"
#include "otbSimpleRcsPanSharpeningFusionImageFilter.h"
int otbSimpleRcsPanSharpeningFusionImageFilter( int argc, char * argv[] )
{
try
{
const char * panchro = argv[1];
const char * multispect = argv[2];
const char * output = argv[3];
const unsigned int Dimension = 2;
typedef double PixelType;
typedef otb::VectorImage<PixelType,Dimension> VectorImageType;
typedef otb::Image<PixelType,Dimension> PanchroImageType;
typedef otb::ImageFileReader<VectorImageType> VectorReaderType;
typedef otb::ImageFileReader<PanchroImageType> ImageReaderType;
typedef otb::StreamingImageFileWriter<VectorImageType> VectorImageWriterType;
typedef otb::SimpleRcsPanSharpeningFusionImageFilter
<PanchroImageType, VectorImageType, VectorImageType> FilterType;
VectorReaderType::Pointer multiSpectReader = VectorReaderType::New();
ImageReaderType::Pointer panchroReader = ImageReaderType::New();
FilterType::Pointer filter = FilterType::New();
VectorImageWriterType::Pointer writer = VectorImageWriterType::New();
multiSpectReader->SetFileName(multispect);
panchroReader->SetFileName(panchro);
filter->SetXsInput(multiSpectReader->GetOutput());
filter->SetPanInput(panchroReader->GetOutput());
writer->SetInput( filter->GetOutput() );
writer->SetFileName(output);
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;
}
return EXIT_SUCCESS;
}
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "itkExceptionObject.h"
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "otbVectorImage.h"
#include "otbImage.h"
#include "otbSimpleRcsPanSharpeningFusionImageFilter.h"
int otbSimpleRcsPanSharpeningFusionImageFilterNew( int argc, char * argv[] )
{
try
{
const unsigned int Dimension = 2;
typedef double PixelType;
typedef otb::VectorImage<PixelType,Dimension> VectorImageType;
typedef otb::Image<PixelType,Dimension> PanchroImageType;
typedef otb::ImageFileReader<VectorImageType> VectorReaderType;
typedef otb::ImageFileReader<PanchroImageType> ImageReaderType;
typedef otb::SimpleRcsPanSharpeningFusionImageFilter
<PanchroImageType, VectorImageType, VectorImageType> FilterType;
FilterType::Pointer filter = FilterType::New();
}
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;
}
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