Skip to content
Snippets Groups Projects
Commit 00af4e34 authored by Thomas Feuvrier's avatar Thomas Feuvrier
Browse files

Répertoire pour les FAs

parent a530037c
No related branches found
No related tags found
No related merge requests found
#include "itkImage.h"
#include "itkImageFileWriter.h"
#include <iostream>
#include "itkPolyLineParametricPath.h"
#include "otbImageFileReader.h"
#include "otbExtractROI.h"
#include "otbImageToPathListAlignFilter.h"
#include "otbDrawPathFilter.h"
//#include "otbColorImageViewer.h"
#include <stdio.h>
int main( int argc, char ** argv )
{
if(argc!=3)
{
std::cout << "Usage : " << argv[0] << " inputImage outputImage" << std::endl;
return 1;
}
const char * inputFilename = argv[1];
const char * outputFilename = argv[2];
typedef unsigned char InputPixelType;
typedef unsigned char OutputPixelType;
const unsigned int Dimension = 2;
typedef itk::Image< InputPixelType, Dimension > InputImageType;
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
typedef otb::ImageFileReader< InputImageType > ReaderType;
typedef itk::ImageFileWriter< OutputImageType > WriterType;
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName( inputFilename );
writer->SetFileName( outputFilename );
reader->Update();
std::cout << "Lecture terminee" << std::endl;
typedef otb::ExtractROI<InputPixelType,InputPixelType> ROIFilterType;
ROIFilterType::Pointer roiFilter = ROIFilterType::New();
roiFilter->SetInput( reader->GetOutput() );
roiFilter->SetStartX( 10 );
roiFilter->SetStartY( 0 );
roiFilter->SetSizeX( 256 );
roiFilter->SetSizeY( 256 );
roiFilter->Update();
std::cout << "Extraction ROI" << std::endl;
typedef itk::PolyLineParametricPath< Dimension > PathType;
typedef otb::ImageToPathListAlignFilter<InputImageType,PathType> ListAlignFilterType;
ListAlignFilterType::Pointer alignFilter = ListAlignFilterType::New();
alignFilter->SetInput( roiFilter->GetOutput() );
alignFilter->Update();
std::cout << "Alignements termines" << std::endl;
typedef ROIFilterType::OutputImageType BackgroundImageType;
typedef otb::DrawPathFilter< BackgroundImageType, PathType, OutputImageType > DrawPathFilterType;
DrawPathFilterType::Pointer drawPathFilter = DrawPathFilterType::New();
typedef ListAlignFilterType::OutputPathListType ListType;
ListType* listePaths = alignFilter->GetOutput();
ListType::iterator listIt = listePaths->begin();
BackgroundImageType::Pointer backgroundImage = roiFilter->GetOutput();
roiFilter->Update();
unsigned int color = 0;
while( listIt != listePaths->end())
{
drawPathFilter->SetImageInput( backgroundImage );
drawPathFilter->SetPathInput( *(listIt) );
//drawPathFilter->SetPathValue( color );
drawPathFilter->Update();
backgroundImage = drawPathFilter->GetOutput();
++listIt;
++color;
}
writer->SetInput( drawPathFilter->GetOutput() );
writer->Update();
/* typedef otb::ColorImageViewer<unsigned char,double> ViewerType;
ViewerType viewer;
viewer.SetLabel( "Input Image" );
viewer.SetImage( drawPathFilter->GetOutput() );
viewer.Show();
Fl::run();
*/
return EXIT_SUCCESS;
}
# $Id$
IF( NOT OTB_DISABLE_CXX_TESTING )
SET(BASELINE ${OTB_DATA_ROOT}/Baseline/Images)
SET(INPUTDATA ${OTB_DATA_ROOT}/Input)
SET(TEMP ${OTBTesting_BINARY_DIR}/Temporary)
#Images de teledetection (grosses images )
SET(IMAGEDATA ${OTB_DATA_DIR} )
#Tolerance sur diff pixel image
SET(TOL 0.0)
# !!!!! Pointe sur un exe gnr dans le repertoire Common
SET(COMMON_TESTS ${CXX_TEST_PATH}/otbCommonTests)
SET(IO_TESTS ${CXX_TEST_PATH}/otbIOTests)
# ------- FAs traitees -----------------------------------
# --- FA 00005 ENVI (GDAL) image multi-canal ---
ADD_TEST(FA-00005-io_EnviMultiBande ${COMMON_TESTS}
otbMultiChannelExtractROI
-double ${INPUTDATA}/GomaBestScale_w15_50.raw
-double ${TEMP}/FA-00005-io_EnviMultiBande_GomaBestScale_w15_50_100_120_150_200.hd
-startX 100 -startY 150 -sizeX 150 -sizeY 200
-channels 1 2 3)
# --- FA 00006 ENVI (GDAL) Conversion Type de pixel ---
ADD_TEST(FA-00006-io_Poupees_OCT_UChar2Double ${COMMON_TESTS}
# --compare-image ${TOL} ${BASELINE}/ioMultiMonoChannelROI_ENVI2PNG_poupees_1canal_302_2_134_330.png
# ${TEMP}/ioMultiMonoChannelROI_ENVI2PNG_poupees_1canal_302_2_134_330.png
otbMultiToMonoChannelExtractROI
-uchar ${INPUTDATA}/poupees_1canal.hd
-double ${TEMP}/FA-00006-io_Poupees_1canal_r8.hd )
ADD_TEST(FA-00006-io_Poupees_OCT_Double2Double ${COMMON_TESTS}
--compare-binary ${TEMP}/FA-00006-io_Poupees_1canal_r8.c1
${TEMP}/FA-00006-io_Poupees_1canal_r8_bis.c1
otbMultiToMonoChannelExtractROI
-double ${INPUTDATA}/poupees_1canal.hd
-double ${TEMP}/FA-00006-io_Poupees_1canal_r8_bis.hd )
ADD_TEST(FA-00006-io_Poupees_OCT_Double2UChar ${COMMON_TESTS}
--compare-binary ${INPUTDATA}/poupees_1canal.c1
${TEMP}/FA-00006-io_Poupees_1canal_oct.c1
otbMultiToMonoChannelExtractROI
-double ${INPUTDATA}/poupees_1canal.hd
-uchar ${TEMP}/FA-00006-io_Poupees_1canal_oct.hd )
ADD_TEST(FA-00006-io_Poupees_R8_Double2UCharBis ${COMMON_TESTS}
--compare-binary ${INPUTDATA}/poupees_1canal.c1
${TEMP}/FA-00006-io_Poupees_1canal_oct_bis.c1
otbMultiToMonoChannelExtractROI
-double ${TEMP}/FA-00006-io_Poupees_1canal_r8.hd
-uchar ${TEMP}/FA-00006-io_Poupees_1canal_oct_bis.hd )
# ------ RADASAT ------------
ADD_TEST(FA-00006-io_Radarsat_UI2_UShort2UShort ${COMMON_TESTS}
otbMultiToMonoChannelExtractROI
-ushort ${IMAGEDATA}/RADARSAT1/SCENE01/
-ushort ${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_ui2.hd
-startX 2559 -startY 3591 -sizeX 337 -sizeY 280 )
ADD_TEST(FA-00006-io_Radarsat_UI2_Int2Int ${COMMON_TESTS}
otbMultiToMonoChannelExtractROI
-int ${IMAGEDATA}/RADARSAT1/SCENE01/
-int ${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_i4.hd
-startX 2559 -startY 3591 -sizeX 337 -sizeY 280 )
ADD_TEST(FA-00006-io_Radarsat_UI2_Double2Double_ ${COMMON_TESTS}
otbMultiToMonoChannelExtractROI
-double ${IMAGEDATA}/RADARSAT1/SCENE01/
-double ${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_r8.hd
-startX 2559 -startY 3591 -sizeX 337 -sizeY 280 )
ADD_TEST(FA-00006-io_Radarsat_I4_Int2Double ${COMMON_TESTS}
--compare-binary ${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_r8.c1
${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_r8_bis.c1
otbMultiToMonoChannelExtractROI
-int ${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_i4.hd
-double ${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_r8_bis.hd
)
ADD_TEST(FA-00006-io_Radarsat_I4_Double2Double ${COMMON_TESTS}
--compare-binary ${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_r8.c1
${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_r8_ter.c1
otbMultiToMonoChannelExtractROI
-double ${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_i4.hd
-double ${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_r8_ter.hd
)
ADD_TEST(FA-00006-io_Radarsat_R8_Double2Double ${COMMON_TESTS}
--compare-binary ${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_r8.c1
${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_r8_4.c1
otbMultiToMonoChannelExtractROI
-double ${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_r8.hd
-double ${TEMP}/FA-00006-io_Radarsat_2559_3591_337_280_r8_4.hd
)
ADD_TEST(FA-00012-co_AlignementsQB ${CXX_TEST_PATH}/AlignementsQB
${INPUTDATA}/poupees.hd
${TEMP}/FA-00012-co_AlignementsQB.png
)
# --- FA 00013 : impossible d'crire une image TIFF(CAI) ---
ADD_TEST(FA-00013-io_WriteImageTIFF ${IO_TESTS}
otbImageFileWriterTest
${INPUTDATA}/sbuv_NB_c1.png
${TEMP}/FA-00013-io_WriteImageTIFF_sbuv_NB_c1.tif )
ADD_TEST(FA-00013-io_WriteImageTIFF_bis ${COMMON_TESTS}
otbMultiToMonoChannelExtractROI
${INPUTDATA}/sbuv_NB_c1.png
${TEMP}/FA-00013-io_WriteImageTIFF_sbuv_NB_c1_extrait.tif
-startX 0 -startY 0 -sizeX 60 -sizeY 488 )
# ------- Fin des FAs traitees -----------------------------------
INCLUDE_DIRECTORIES("${OTBTesting_BINARY_DIR}")
ADD_EXECUTABLE(AlignementsQB AlignementsQB.cxx)
TARGET_LINK_LIBRARIES(AlignementsQB OTBFeatureExtraction OTBIO OTBCommon ${CAI_LIBRARY} ${GDAL_LIBRARY} ITKIO ITKCommon)
ENDIF( NOT OTB_DISABLE_CXX_TESTING )
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