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

ENH:new hyperspectral unmixing example (not added yet in OTB-Documents ->...

ENH:new hyperspectral unmixing example (not added yet in OTB-Documents -> extract of aviris data to big for the OTB-Data repository)
parent 76d17cbc
No related branches found
No related tags found
No related merge requests found
......@@ -5,37 +5,48 @@
PROJECT(HyperspectralExamples)
INCLUDE_REGULAR_EXPRESSION("^.*$")
ADD_EXECUTABLE(HyperspectralUnmixingExample HyperspectralUnmixing.cxx )
ADD_EXECUTABLE(HyperspectralUnmixingExample HyperspectralUnmixingExample.cxx )
TARGET_LINK_LIBRARIES(HyperspectralUnmixingExample OTBCommon OTBIO OTBHyperspectral)
IF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
SET(BASELINE ${OTB_DATA_ROOT}/Baseline/Examples/Hyperspctral)
SET(BASELINE ${OTB_DATA_ROOT}/Baseline/Examples/Hyperspectral)
SET(BASELINE_IMAGES_OTB ${OTB_DATA_ROOT}/Baseline/OTB/Images)
SET(INPUTDATA_EXAMPLES ${OTB_DATA_ROOT}/Examples)
SET(INPUTDATA ${OTB_DATA_ROOT}/Input)
SET(TEMP ${OTB_BINARY_DIR}/Testing/Temporary)
IF(OTB_DATA_USE_LARGEINPUT)
SET(IMAGEDATA ${OTB_DATA_LARGEINPUT_ROOT} )
ENDIF(OTB_DATA_USE_LARGEINPUT)
SET(EXE_TESTS ${CXX_TEST_PATH}/otbHyperspectralExamplesTests)
SET(TOL 0.0)
# tests#
# ------- HyperspectralUnmixingExampleTest ----------
IF(OTB_DATA_USE_LARGEINPUT)
ADD_TEST(siTvHyperspectralExampleTest ${EXE_TESTS}
#--compare-image ${TOL} ${BASELINE}/siTvUnmixingExampleTest.txt
# ${TEMP}/siTvUnmixingExampleTest.txt
--compare-n-images ${TOL} 3
${BASELINE}/siTvHyperspectralUnmixingExampleTestBand1.png
${TEMP}/siTvHyperspectralUnmixingExampleTestBand1.png
${BASELINE}/siTvHyperspectralUnmixingExampleTestBand2.png
${TEMP}/siTvHyperspectralUnmixingExampleTestBand2.png
${BASELINE}/siTvHyperspectralUnmixingExampleTestBand3.png
${TEMP}/siTvHyperspectralUnmixingExampleTestBand3.png
HyperspectralUnmixingExample
${INPUTDATA_EXAMPLES}/Indian_pines_corrected.tif
${IMAGEDATA}/AVIRIS/Indian_pines_corrected.tif
${TEMP}/siTvHyperspectralUnmixingExampleTest.tif
${TEMP}/siTvHyperspectralUnmixingExampleTestBand1.png
${TEMP}/siTvHyperspectralUnmixingExampleTestBand2.png
${TEMP}/siTvHyperspectralUnmixingExampleTestBand3.png
16
)
ENDIF(OTB_DATA_USE_LARGEINPUT)
INCLUDE_DIRECTORIES(${OTB_SOURCE_DIR}/Testing/Code)
......
......@@ -18,7 +18,6 @@
#include "otbVectorImage.h"
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "otbStreamingStatisticsVectorImageFilter.h"
#include "otbVectorRescaleIntensityImageFilter.h"
#include "otbVectorImageToMatrixImageFilter.h"
#include "itkRescaleIntensityImageFilter.h"
......@@ -45,6 +44,7 @@
#include "otbVcaImageFilter.h"
#include "otbUnConstrainedLeastSquareImageFilter.h"
// Software Guide : EndCodeSnippet
int main(int argc, char * argv[])
{
if (argc != 7)
......@@ -83,8 +83,7 @@ int main(int argc, char * argv[])
typedef vnl_vector<double> VectorType;
typedef vnl_matrix<double> MatrixType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We instantiate now the image reader and we set the image file name.
......@@ -106,7 +105,6 @@ int main(int argc, char * argv[])
// \doxygen{otb}{VectorRescaleIntensityImageFilter}.
//
// Software Guide : EndLatex
//rescale input image between 0 and 1
// Software Guide : BeginCodeSnippet
RescalerType::Pointer rescaler = RescalerType::New();
......@@ -199,6 +197,7 @@ int main(int argc, char * argv[])
// \end{figure}
//
// Software Guide : EndLatex
typedef otb::Image<PixelType, Dimension> MonoImageType;
typedef otb::MultiToMonoChannelExtractROI<PixelType, PixelType> ExtractROIFilterType;
typedef otb::Image<unsigned char, 2> OutputImageType;
......@@ -225,4 +224,4 @@ int main(int argc, char * argv[])
}
return EXIT_SUCCESS;
} // end main
}
......@@ -27,5 +27,5 @@ void RegisterTests()
}
#undef main
#define main Unmixing
#define main HyperspectralUnmixingExample
#include "HyperspectralUnmixingExample.cxx"
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