diff --git a/Testing/Code/BasicFilters/CMakeLists.txt b/Testing/Code/BasicFilters/CMakeLists.txt index 7bc20d4cdfa849df7d9b80e2d22cdc3177fe1efb..894a4406b7b1a0dd57697d8a78f051952324ae9a 100644 --- a/Testing/Code/BasicFilters/CMakeLists.txt +++ b/Testing/Code/BasicFilters/CMakeLists.txt @@ -1109,7 +1109,7 @@ ADD_TEST(bfTvExtractROIResample ${BASICFILTERS_TESTS11} ADD_TEST(bfTvExtractROIResample2 ${BASICFILTERS_TESTS11} --compare-image ${TOL} - ${BASELINE_FILES}/bfTvExtractROIResample2.tif + ${BASELINE}/bfTvExtractROIResample2.tif ${TEMP}/bfTvExtractROIResample2.tif otbExtractROIResample ${INPUTDATA}/ToulouseQuickBird_Extrait_1500_3750.tif @@ -1146,12 +1146,12 @@ ADD_TEST(bfTuPointSetToDensityImageFilterNew ${BASICFILTERS_TESTS11} ADD_TEST(bfTvPointSetToDensityImageFilterTest ${BASICFILTERS_TESTS11} --compare-image ${TOL} - ${BASELINE_FILES}/bfTvPointSetToDensityImageFilterOutputImage.tif + ${BASELINE}/bfTvPointSetToDensityImageFilterOutputImage.tif ${TEMP}/bfTvPointSetToDensityImageFilterOutputImage.tif otbPointSetToDensityImageFilterTest ${INPUTDATA}/QB_Suburb.png ${TEMP}/bfTvPointSetToDensityImageFilterOutputImage.tif - 5 2 + 3 5 10 ) # ------- otbPCAShapeModelEstimatorTest ---------------------------- @@ -1170,15 +1170,15 @@ ADD_TEST(bfTuKeyPointDensityImageFilterNew ${BASICFILTERS_TESTS11} otbKeyPointDensityImageFilterNew ) -#ADD_TEST(bfTvCountImageFilterOutputImage ${BASICFILTERS_TESTS11} -#--compare-image ${TOL} -# ${BASELINE_FILES}/bfTvCountImageFilterOutputImage.tif -# ${TEMP}/bfTvCountImageFilterOutputImage.tif -# otbCountImageFilterTest -# ${INPUTDATA}/QB_Suburb.png -# ${TEMP}/bfTvCountImageFilterOutputImage.tif -# 5 2 -#) +ADD_TEST(bfTvKeyPointDensityImageFilterOutputImage ${BASICFILTERS_TESTS11} +--compare-image ${TOL} + ${BASELINE}/bfTvKeyPointDensityImageFilterOutputImage.tif + ${TEMP}/bfTvKeyPointDensityImageFilterOutputImage.tif + otbKeyPointDensityImageFilterTest + ${INPUTDATA}/QB_Suburb.png + ${TEMP}/bfTvKeyPointDensityImageFilterOutputImage.tif + 3 5 10 +) ADD_TEST(bfTvFunctionWithNeighborhoodToImageFilterNew ${BASICFILTERS_TESTS11} otbFunctionWithNeighborhoodToImageFilterNew @@ -1351,7 +1351,7 @@ otbPointSetDensityFunctionTest.cxx otbPointSetToDensityImageFilterNew.cxx otbPointSetToDensityImageFilterTest.cxx otbKeyPointDensityImageFilterNew.cxx -#otbCountImageFilterTest.cxx +otbKeyPointDensityImageFilterTest.cxx otbImagePCAShapeModelEstimatorTest.cxx otbFunctionWithNeighborhoodToImageFilterNew.cxx ) diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests11.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests11.cxx index 57ff26ff626d3dc768f07d8cf474b1117fcc3e0b..95899199316cd3dd4c56c76543a214150439462e 100644 --- a/Testing/Code/BasicFilters/otbBasicFiltersTests11.cxx +++ b/Testing/Code/BasicFilters/otbBasicFiltersTests11.cxx @@ -34,7 +34,7 @@ REGISTER_TEST(otbPointSetDensityFunctionTest); REGISTER_TEST(otbPointSetToDensityImageFilterNew); REGISTER_TEST(otbPointSetToDensityImageFilterTest); REGISTER_TEST(otbKeyPointDensityImageFilterNew); -//REGISTER_TEST(otbCountImageFilterTest); +REGISTER_TEST(otbKeyPointDensityImageFilterTest); REGISTER_TEST(otbImagePCAShapeModelEstimatorTest); REGISTER_TEST(otbFunctionWithNeighborhoodToImageFilterNew); } diff --git a/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterTest.cxx b/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2505769be31d748574bc4546c572843b3165a262 --- /dev/null +++ b/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterTest.cxx @@ -0,0 +1,79 @@ +/*========================================================================= + +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 <stdio.h> + +#include "otbKeyPointDensityImageFilter.h" +#include "otbImageToSIFTKeyPointSetFilter.h" +#include "itkPointSet.h" +#include "itkVariableLengthVector.h" +#include "otbImage.h" + +#include "otbImageFileReader.h" +#include "otbImageFileWriter.h" + +int otbKeyPointDensityImageFilterTest(int argc, char* argv[] ) +{ + const char * infname = argv[1]; + const char * outfname = argv[2]; + const unsigned int scales = atoi(argv[3]); + const unsigned int octaves = atoi(argv[4]); + const unsigned int radius = atoi(argv[5]); + + const unsigned int Dimension = 2; + typedef float PixelType; + + typedef otb::Image< PixelType, Dimension > ImageType; + typedef ImageType::IndexType IndexType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<ImageType> WriterType; + typedef itk::VariableLengthVector<PixelType> RealVectorType; + typedef itk::PointSet<RealVectorType,Dimension> PointSetType; + typedef otb::ImageToSIFTKeyPointSetFilter<ImageType,PointSetType> DetectorType; + + typedef otb::KeyPointDensityImageFilter< ImageType,DetectorType, ImageType> FilterType; + + + /**Instancitation of an object*/ + FilterType::Pointer filter = FilterType::New(); + DetectorType::Pointer detector = DetectorType::New(); + ReaderType::Pointer reader = ReaderType::New(); + + reader->SetFileName(infname); + reader->GenerateOutputInformation(); + + filter->SetInput(reader->GetOutput()); + detector = filter->GetDetector(); + detector ->SetOctavesNumber(octaves); + detector->SetScalesNumber(scales); + + + filter->SetDetector(detector); + filter->SetNeighborhoodRadius(radius); + + /** Writing the densty Image*/ + WriterType::Pointer writer = WriterType::New(); + writer->SetFileName(outfname); + writer->SetInput(filter->GetOutput()); + writer->Update(); + + + + return EXIT_SUCCESS; +} +