diff --git a/Code/FeatureExtraction/otbCloudDetectionFunctor.h b/Code/FeatureExtraction/otbCloudDetectionFunctor.h index b6aa79eab5c708449fbd3ad7509f31f87ef94926..a21786358f8eb4bf49b4a3710c80df44a9d5311c 100644 --- a/Code/FeatureExtraction/otbCloudDetectionFunctor.h +++ b/Code/FeatureExtraction/otbCloudDetectionFunctor.h @@ -44,7 +44,7 @@ public: ~CloudDetectionFunctor() {}; inline TOutputValue operator()(const TInput& inPix) { - if ( (m_CloudEstimatorFunctor(inPix)>m_MinThreshold) && (m_CloudEstimatorFunctor(inPix)<m_MaxThreshold) ) + if ( (m_CloudEstimatorFunctor(inPix)>m_MinThreshold) && (m_CloudEstimatorFunctor(inPix)<=m_MaxThreshold) ) { return 1; } diff --git a/Code/FeatureExtraction/otbSpectralAngleFunctor.h b/Code/FeatureExtraction/otbSpectralAngleFunctor.h index 38c36ef1b63fc268026835641f88f11f51ccbeb9..85d81cf8042c68b2362556bc5f44a6c63734078e 100644 --- a/Code/FeatureExtraction/otbSpectralAngleFunctor.h +++ b/Code/FeatureExtraction/otbSpectralAngleFunctor.h @@ -19,6 +19,7 @@ #define __otbSpectralAngleFunctor_h #include "otbMath.h" +#include <algorithm> namespace otb { diff --git a/Code/Radiometry/otbVegetationIndex.h b/Code/Radiometry/otbVegetationIndex.h index 9304da4f3a9db43063f2c0484fbed068bd609175..ead5d02719e3f2b4fb1dd1a097fef76e0327d16d 100644 --- a/Code/Radiometry/otbVegetationIndex.h +++ b/Code/Radiometry/otbVegetationIndex.h @@ -321,6 +321,7 @@ public: return static_cast<TOutput>(0.); } return ( static_cast<TOutput>( m_G * (dnir - dr)/denominator ) ); +//return ( static_cast<TOutput>( dnir ) ); } /** Set/Get G parameter */ void SetG(const double g) diff --git a/Examples/FeatureExtraction/CMakeLists.txt b/Examples/FeatureExtraction/CMakeLists.txt index e0301c735f7442d2710fde08d17f615450087e90..f85666ebcdd3cd9e31304073c3037765546042e1 100644 --- a/Examples/FeatureExtraction/CMakeLists.txt +++ b/Examples/FeatureExtraction/CMakeLists.txt @@ -82,6 +82,9 @@ ADD_EXECUTABLE(ParallelLineDetectionExample ParallelLineDetectionExample.cxx) TARGET_LINK_LIBRARIES(ParallelLineDetectionExample OTBIO OTBCommon OTBFeatureExtraction ITKCommon ITKBasicFilters) +ADD_EXECUTABLE(CloudDetectionExample CloudDetectionExample.cxx) +TARGET_LINK_LIBRARIES(CloudDetectionExample OTBIO OTBCommon OTBFeatureExtraction +ITKCommon ITKBasicFilters) IF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING ) @@ -293,6 +296,18 @@ ADD_TEST(ScaleInvariantFeatureImageFilterTest ${EXE_TESTS2} 1 10 0.5 0 ) +# ------- CloudDetectionExampleTest---------- + +ADD_TEST(CloudDetectionExampleTest ${EXE_TESTS2} + --compare-image ${TOL} + ${BASELINE}/CloudDetectionOutput.png + ${TEMP}/CloudDetectionOutput.png + CloudDetectionExampleTest + ${INPUTDATA}/CloudsOnReunion.tif + ${TEMP}/CloudDetectionOutput.png + 553 467 734 581 0.4 0.6 1.0 +) + ADD_EXECUTABLE(otbFeatureExtractionExamplesTests1 otbFeatureExtractionExamplesTests1.cxx) TARGET_LINK_LIBRARIES(otbFeatureExtractionExamplesTests1 gdal ITKIO ITKAlgorithms ITKStatistics ITKCommon OTBBasicFilters OTBCommon OTBDisparityMap OTBIO OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction OTBLearning OTBMultiScale) diff --git a/Examples/FeatureExtraction/otbFeatureExtractionExamplesTests2.cxx b/Examples/FeatureExtraction/otbFeatureExtractionExamplesTests2.cxx index 1e6a74294c45a4e645682a37b33d976359dde5df..dec218af753b8e7f491d495ead88ab46a4899ce7 100644 --- a/Examples/FeatureExtraction/otbFeatureExtractionExamplesTests2.cxx +++ b/Examples/FeatureExtraction/otbFeatureExtractionExamplesTests2.cxx @@ -31,6 +31,7 @@ void RegisterTests() REGISTER_TEST(SeamCarvingOtherExampleTest); //REGISTER_TEST(ImageToSIFTKeyPointSetFilterTest); REGISTER_TEST(ScaleInvariantFeatureImageFilterTest); + REGISTER_TEST(CloudDetectionExampleTest); } #undef main @@ -56,3 +57,8 @@ void RegisterTests() #undef main #define main ScaleInvariantFeatureImageFilterTest #include "ScaleInvariantFeatureImageFilter.cxx" + +#undef main +#define main CloudDetectionExampleTest +#include "CloudDetectionExample.cxx" + diff --git a/Testing/Code/Radiometry/CMakeLists.txt b/Testing/Code/Radiometry/CMakeLists.txt index b49d17bd43ca3ba338b71f3ec09ace193297a47c..d6943c4f5971e0536d16d5769ea2249e47bb41d2 100644 --- a/Testing/Code/Radiometry/CMakeLists.txt +++ b/Testing/Code/Radiometry/CMakeLists.txt @@ -520,7 +520,43 @@ ADD_TEST(raTvEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter ${RADIOMETRY_T 1.0 # canopy background adjustment ) +# ------- otb::MultiChannelRAndBAndNIRVegetationIndexImageFilter ------------------------------ + +ADD_TEST(raTvNewARVI_MultiChannelRAndBAndNIRVegetationIndexImageFilter ${RADIOMETRY_TESTS2} + #--compare-image ${EPSILON} ${BASELINE}/raRAndBAndNIRVegetationIndex_ARVI_poupees_subc1c2c3.tif + # ${TEMP}/raMultiChannelRAndBAndNIRVegetationIndex_ARVI_poupees_subc1c2c3.tif + otbMultiChannelRAndBAndNIRVegetationIndexImageFilter + ARVI + ${OTB_DATA_ROOT}/Examples/VegetationIndex.hd + ${TEMP}/raRAndBAndNIRVegetationIndex_ARVI_qb_RoadExtract.tif + 1 3 2 # red blue nir + 0.6 # Gamma parameter +) + +ADD_TEST(raTvTotoARVI_MultiChannelRAndBAndNIRVegetationIndexImageFilter ${RADIOMETRY_TESTS2} + #--compare-image ${EPSILON} ${BASELINE}/raRAndBAndNIRVegetationIndex_ARVI_poupees_subc1c2c3.tif + # ${TEMP}/raMultiChannelRAndBAndNIRVegetationIndex_ARVI_poupees_subc1c2c3.tif + otbMultiChannelRAndBAndNIRVegetationIndexImageFilter + ARVI + ${INPUTDATA}/qb_RoadExtract.img.hdr + ${TEMP}/raRAndBAndNIRVegetationIndex_ARVI_qb_RoadExtract.tif + 3 1 4 # red blue nir + 0.6 # Gamma parameter +) +ADD_TEST(raTvNewEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter ${RADIOMETRY_TESTS4} + #--compare-image ${EPSILON} ${BASELINE}/raRAndBAndNIRVegetationIndex_EVI_poupees_subc1c2c3.tif + # ${TEMP}/raRAndBAndNIRVegetationIndex_EVI_poupees_subc1c2c3.tif + otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter + EVI + ${OTB_DATA_ROOT}/Examples/VegetationIndex.hd + ${TEMP}/raRAndBAndNIRVegetationIndex_EVI_qb_RoadExtract.tif + 1 2 3 # red blue nir + 2.5 # gain factor + 6.0 # coefficient of the aerosol resistance term + 7.5 # coefficient of the aerosol resistance term + 1.0 # canopy background adjustment +) # A enrichir SET(Radiometry_SRCS1 diff --git a/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx index bd3d6503c45b9fa0d68c939a7d0857ce6c5593f9..c8d18acff476275c6591a14acb1d44c01aa6de67 100644 --- a/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx @@ -45,6 +45,7 @@ int generic_EVIMultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char unsigned int redChannel(::atoi(argv[3])); unsigned int blueChannel(::atoi(argv[4])); unsigned int nirChannel(::atoi(argv[5])); +std::cout << "ORDER : "<<redChannel<<" "<<blueChannel<<" "<<nirChannel<<std::endl; double g(::atof(argv[6])); double c1(::atof(argv[7])); diff --git a/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx index a2e8f87ed377dc7429b390914d1b6ba876de0262..9966707b51a99b338714cdcdb2a8bfc532155c0d 100644 --- a/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx @@ -61,7 +61,7 @@ int generic_MultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char * a int otbMultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<unsigned char ,Dimension> InputImageType; + typedef otb::VectorImage<double ,Dimension> InputImageType; typedef otb::Image<float,Dimension> OutputImageType; std::string strArgv(argv[1]);