From de6ba88342a9f739b2a34129ff00ddc5607a1fb7 Mon Sep 17 00:00:00 2001 From: Stephane ALBERT <stephane.albert@c-s.fr> Date: Thu, 24 Aug 2017 11:10:59 +0200 Subject: [PATCH] ENH: Improved FastSIFTKeyPointSetFilterOutputInterestPointAscii test. --- ...PointSetFilterOutputInterestPointAscii.cxx | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/Modules/Feature/Descriptors/test/otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii.cxx b/Modules/Feature/Descriptors/test/otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii.cxx index 4a2a416e5f..d5f0f32747 100644 --- a/Modules/Feature/Descriptors/test/otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii.cxx +++ b/Modules/Feature/Descriptors/test/otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii.cxx @@ -36,9 +36,9 @@ bool CMP(std::vector<float> a, std::vector<float> b) return lexicographical_compare(a.begin(), a.begin() + 2, b.begin(), b.begin() + 2); } -int otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii(int itkNotUsed(argc), char * argv[]) +int +otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii( int itkNotUsed( argc ), char * argv[] ) { - const char * infname = argv[1]; const char * outfname = argv[2]; @@ -59,7 +59,7 @@ int otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii(int itkNotUsed(a typedef PointSetType::PointDataContainer PointDataContainerType; typedef PointDataContainerType::Iterator PointDataIteratorType; - typedef std::vector<float> siftDataVector; + typedef std::vector< RealType > siftDataVector; typedef std::vector<siftDataVector> ImageDataType; //Kind of PointSet with vectors // Instantiating object @@ -76,10 +76,29 @@ int otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii(int itkNotUsed(a PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); PointDataIteratorType pDataIt = filter->GetOutput()->GetPointData()->Begin(); + assert( + filter->GetOutput()->GetPoints()->Size() == + filter->GetOutput()->GetPointData()->Size() ); + std::ofstream outfile(outfname); outfile << "Number of scales: " << scales << std::endl; - outfile << "Number of SIFT key points: " << filter->GetOutput()->GetNumberOfPoints() << std::endl; + + outfile << "Number of SIFT key points: " + << filter->GetOutput()->GetNumberOfPoints() + << std::endl; + + outfile << "Number of points: " + << filter->GetOutput()->GetPoints()->Size() + << std::endl; + + outfile << "Number of points data: " + << filter->GetOutput()->GetPointData()->Size() + << std::endl; + + if( filter->GetOutput()->GetPoints()->Size() != + filter->GetOutput()->GetPointData()->Size() ) + return EXIT_FAILURE; // Copy the PointSet to std::vector< std::vector > while (pIt != filter->GetOutput()->GetPoints()->End()) -- GitLab