Skip to content
Snippets Groups Projects
Commit 9ac0f605 authored by Manuel Grizonnet's avatar Manuel Grizonnet
Browse files

Backed out changeset b4983b777a9d

parent a70b4a39
Branches
Tags
No related merge requests found
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "otbOrthoRectification.h" #include "otbOrthoRectification.h"
#include "otbVectorImage.h" #include "otbVectorImage.h"
#include "otbImage.h"
#include "otbImageFileReader.h" #include "otbImageFileReader.h"
#include "otbStreamingImageFileWriter.h" #include "otbStreamingImageFileWriter.h"
...@@ -33,12 +32,8 @@ ...@@ -33,12 +32,8 @@
#include "otbBCOInterpolateImageFunction.h" #include "otbBCOInterpolateImageFunction.h"
#include "itkNearestNeighborInterpolateImageFunction.h" #include "itkNearestNeighborInterpolateImageFunction.h"
#include "otbImageToGenericRSOutputParameters.h" #include "otbImageToGenericRSOutputParameters.h"
#include "projection/ossimUtmProjection.h"
#include "otbSimpleRcsPanSharpeningFusionImageFilter.h"
#include "otbVectorRescaleIntensityImageFilter.h"
#include "otbImageToLuminanceImageFilter.h" #include "projection/ossimUtmProjection.h"
#include "otbLuminanceToReflectanceImageFilter.h"
#include "otbPipelineMemoryPrintCalculator.h" #include "otbPipelineMemoryPrintCalculator.h"
...@@ -51,14 +46,13 @@ int generic_main(otb::ApplicationOptionsResult* parseResult, ...@@ -51,14 +46,13 @@ int generic_main(otb::ApplicationOptionsResult* parseResult,
{ {
try try
{ {
typedef otb::VectorImage<unsigned short int, 2> ImageType; typedef otb::VectorImage<double, 2> ImageType;
typedef otb::Image<unsigned short int> PanImageType;
//typedef otb::VectorImage<unsigned short int, 2> IntImageType;
typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::ImageFileReader<ImageType> ReaderType;
typedef otb::StreamingImageFileWriter<ImageType> WriterType; typedef otb::StreamingImageFileWriter<ImageType> WriterType;
typedef TMapProjection MapProjectionType; typedef TMapProjection MapProjectionType;
typedef otb::OrthoRectificationFilter< ImageType, ImageType, MapProjectionType > OrthorectifFilterType; typedef otb::OrthoRectificationFilter< ImageType, ImageType, MapProjectionType > OrthorectifFilterType;
typedef otb::GenericRSResampleImageFilter < ImageType, ImageType > ResampleFilterType;
typedef itk::LinearInterpolateImageFunction<ImageType, double> LinearInterpolationType; typedef itk::LinearInterpolateImageFunction<ImageType, double> LinearInterpolationType;
typedef itk::NearestNeighborInterpolateImageFunction<ImageType, double> NearestNeighborInterpolationType; typedef itk::NearestNeighborInterpolateImageFunction<ImageType, double> NearestNeighborInterpolationType;
typedef otb::BCOInterpolateImageFunction<ImageType> BCOInterpolationType; typedef otb::BCOInterpolateImageFunction<ImageType> BCOInterpolationType;
...@@ -72,27 +66,8 @@ int generic_main(otb::ApplicationOptionsResult* parseResult, ...@@ -72,27 +66,8 @@ int generic_main(otb::ApplicationOptionsResult* parseResult,
// Orthorectification filter // Orthorectification filter
typename OrthorectifFilterType::Pointer orthofilter = OrthorectifFilterType::New(); typename OrthorectifFilterType::Pointer orthofilter = OrthorectifFilterType::New();
//compute TOA
if (parseResult->IsOptionPresent("TOA"))
{
typedef ImageToLuminanceImageFilter<ImageType, ImageType> ImageToLuminanceImageFilterType;;
typedef LuminanceToReflectanceImageFilter<ImageType, ImageType> LuminanceToReflectanceImageFilterType;
ImageToLuminanceImageFilterType::Pointer imageToLuminanceFilter = ImageToLuminanceImageFilterType::New();
LuminanceToReflectanceImageFilterType::Pointer luminanceToReflectanceFilter = LuminanceToReflectanceImageFilterType::New();
imageToLuminanceFilter->SetInput(reader->GetOutput());
//TODO compute in reflectance *1000 and cast as unsigned short int
luminanceToReflectanceFilter->SetInput(imageToLuminanceFilter->GetOutput());
orthofilter->SetInput(imageToLuminanceFilter->GetOutput());
}
else
{
orthofilter->SetInput(reader->GetOutput()); orthofilter->SetInput(reader->GetOutput());
}
// If activated, generate RPC model // If activated, generate RPC model
if(parseResult->IsOptionPresent("RPC")) if(parseResult->IsOptionPresent("RPC"))
{ {
...@@ -223,40 +198,28 @@ int generic_main(otb::ApplicationOptionsResult* parseResult, ...@@ -223,40 +198,28 @@ int generic_main(otb::ApplicationOptionsResult* parseResult,
itkGenericExceptionMacro(<< "Interpolator type not recognized, choose one with (parameters) : BCO(0/1), NEARESTNEIGHBOR(0), LINEAR(0)"); itkGenericExceptionMacro(<< "Interpolator type not recognized, choose one with (parameters) : BCO(0/1), NEARESTNEIGHBOR(0), LINEAR(0)");
} }
} }
orthofilter->UpdateOutputInformation();
//Instantiate the writer
WriterType::Pointer writer = WriterType::New();
writer->SetFileName(parseResult->GetOutputImage());
//Resample xs on pan //Resample xs on pan
if ( parseResult->IsOptionPresent("Pan") ) if ( parseResult->IsOptionPresent("XS") )
{ {
typedef otb::ImageFileReader<PanImageType> PanReaderType; ReaderType::Pointer xsreader = ReaderType::New();
PanReaderType::Pointer panreader = PanReaderType::New(); xsreader->SetFileName(parseResult->GetParameterString("XS"));
panreader->SetFileName(parseResult->GetParameterString("Pan")); xsreader->GenerateOutputInformation();
panreader->GenerateOutputInformation(); //TODO manage calibration case here
//resample result //resample result
typedef otb::GenericRSResampleImageFilter < PanImageType, PanImageType > ResampleFilterType; ResampleFilterType::Pointer resampler = ResampleFilterType::New();
ResampleFilterType::Pointer panresampler = ResampleFilterType::New(); resampler->SetInput(xsreader->GetOutput());
panresampler->SetInput(panreader->GetOutput()); orthofilter->UpdateOutputInformation();
panresampler->SetOutputParametersFromImage(orthofilter->GetOutput()); resampler->SetOutputParametersFromImage(orthofilter->GetOutput());
panresampler->UpdateOutputInformation();
//Add PAN+XS fusion //Add PAN+XS fusion
typedef otb::SimpleRcsPanSharpeningFusionImageFilter
<PanImageType, ImageType, ImageType> FusionFilterType;
FusionFilterType::Pointer fusion = FusionFilterType::New();
fusion->SetPanInput(panresampler->GetOutput());
fusion->SetXsInput(orthofilter->GetOutput());
fusion->UpdateOutputInformation();
writer->SetInput(fusion->GetOutput());
} }
else //Instantiate the writer
{ WriterType::Pointer writer = WriterType::New();
writer->SetFileName(parseResult->GetOutputImage());
writer->SetInput(orthofilter->GetOutput()); writer->SetInput(orthofilter->GetOutput());
}
//Instantiate the pipeline memory print estimator //Instantiate the pipeline memory print estimator
MemoryCalculatorType::Pointer calculator = MemoryCalculatorType::New(); MemoryCalculatorType::Pointer calculator = MemoryCalculatorType::New();
...@@ -268,7 +231,7 @@ int generic_main(otb::ApplicationOptionsResult* parseResult, ...@@ -268,7 +231,7 @@ int generic_main(otb::ApplicationOptionsResult* parseResult,
calculator->SetAvailableMemory(memory / byteToMegabyte); calculator->SetAvailableMemory(memory / byteToMegabyte);
} }
calculator->SetDataToWrite(writer->GetOutput()); calculator->SetDataToWrite(orthofilter->GetOutput());
calculator->Compute(); calculator->Compute();
otbMsgDevMacro(<< "Guess the pipeline memory print " << calculator->GetMemoryPrint()*byteToMegabyte << " Mo"); otbMsgDevMacro(<< "Guess the pipeline memory print " << calculator->GetMemoryPrint()*byteToMegabyte << " Mo");
...@@ -314,8 +277,7 @@ int OrthoRectification::Describe(ApplicationDescriptor* descriptor) ...@@ -314,8 +277,7 @@ int OrthoRectification::Describe(ApplicationDescriptor* descriptor)
descriptor->SetName("FastOrthoRectif"); descriptor->SetName("FastOrthoRectif");
descriptor->SetDescription("Using available image metadata to determine the sensor model, computes a cartographic projection of the image"); descriptor->SetDescription("Using available image metadata to determine the sensor model, computes a cartographic projection of the image");
descriptor->AddInputImage(); descriptor->AddInputImage();
descriptor->AddOption("Pan","The input pan image (will perform orthofusionbetween input image (xs) and pan","pan", 1,false,otb::ApplicationDescriptor::InputImage); descriptor->AddOption("XS","The input multi-spectral image (will perform orthofusion","xs", 1,false,otb::ApplicationDescriptor::InputImage);
descriptor->AddOption("TOA", "compute reflectance on top of the atmosphere","toa", 0, false,ApplicationDescriptor::Boolean);
descriptor->AddOutputImage(); descriptor->AddOutputImage();
descriptor->AddOption("UpperLeft","Cartographic X/Y coordinate of upper left corner ","ul",2, false, otb::ApplicationDescriptor::Real); descriptor->AddOption("UpperLeft","Cartographic X/Y coordinate of upper left corner ","ul",2, false, otb::ApplicationDescriptor::Real);
descriptor->AddOption("OutputSize","Size of result image in X/Y","size",2, false, otb::ApplicationDescriptor::Integer); descriptor->AddOption("OutputSize","Size of result image in X/Y","size",2, false, otb::ApplicationDescriptor::Integer);
...@@ -330,7 +292,7 @@ int OrthoRectification::Describe(ApplicationDescriptor* descriptor) ...@@ -330,7 +292,7 @@ int OrthoRectification::Describe(ApplicationDescriptor* descriptor)
descriptor->AddOptionNParams("InterpolatorType", descriptor->AddOptionNParams("InterpolatorType",
"Type LINEAR/BCO/NEARESTNEIGHBOR (optional, linear by default)","interp", false, otb::ApplicationDescriptor::String); "Type LINEAR/BCO/NEARESTNEIGHBOR (optional, linear by default)","interp", false, otb::ApplicationDescriptor::String);
descriptor->AddOption("AvailableMemory","Set the maximum of available memory for the pipeline execution in mega bytes (optional, 256 by default","ram",1,false, otb::ApplicationDescriptor::Integer); descriptor->AddOption("AvailableMemory","Set the maximum of available memory for the pipeline execution in mega bytes (optional, 256 by default","ram",1,false, otb::ApplicationDescriptor::Integer);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment