diff --git a/Code/FeatureExtraction/otbHarrisImageFilter.h b/Code/FeatureExtraction/otbHarrisImageFilter.h index 5c1fa45052ae755a19107655bd14d3ddabfa9028..422bb04eb8027473d552087fb003d23c70f69be4 100644 --- a/Code/FeatureExtraction/otbHarrisImageFilter.h +++ b/Code/FeatureExtraction/otbHarrisImageFilter.h @@ -15,7 +15,7 @@ #include "itkRecursiveGaussianImageFilter.h" #include "itkHessianRecursiveGaussianImageFilter.h" #include "otbHessianToScalarImageFilter.h" - +#include "itkSymmetricSecondRankTensor.h" namespace otb { @@ -55,13 +55,17 @@ public: typedef typename InputImageType::SizeType SizeType; - typedef itk::HessianRecursiveGaussianImageFilter<InputImageType > HessianFilterType; - typedef typename HessianFilterType::RealImageType RealImageType; + typedef itk::Image< itk::SymmetricSecondRankTensor< + typename itk::NumericTraits< InputPixelType>::RealType, + ::itk::GetImageDimension<InputImageType>::ImageDimension >, + ::itk::GetImageDimension<InputImageType>::ImageDimension > TensorType; + + typedef itk::HessianRecursiveGaussianImageFilter<InputImageType,TensorType > HessianFilterType; +// typedef typename HessianFilterType::RealImageType RealImageType; - typedef itk::RecursiveGaussianImageFilter<RealImageType, - RealImageType> GaussianFilterType; - - typedef HessianToScalarFilter<RealImageType,OutputImageType > HessianToScalarFilterType; + typedef itk::RecursiveGaussianImageFilter<TensorType, + TensorType> GaussianFilterType; + typedef otb::HessianToScalarImageFilter<TensorType,OutputImageType > HessianToScalarFilterType; itkSetMacro(SigmaD,double); itkGetConstReferenceMacro(SigmaD, double); @@ -74,6 +78,9 @@ public: protected: HarrisImageFilter(); virtual ~HarrisImageFilter() {}; + + virtual void GenerateData(); + void PrintSelf(std::ostream& os, itk::Indent indent) const; private: diff --git a/Code/FeatureExtraction/otbHessianToScalarImageFilter.h b/Code/FeatureExtraction/otbHessianToScalarImageFilter.h index 69ce3d82ad213e911d0ec3603b78df217bf2612c..4f32d2c9b547ad37e6a1d8089806121e11965359 100644 --- a/Code/FeatureExtraction/otbHessianToScalarImageFilter.h +++ b/Code/FeatureExtraction/otbHessianToScalarImageFilter.h @@ -27,7 +27,7 @@ template< class TInput, class TOutput > class HessianToScalar { public: - HessianToScalar() {m_Alpha = 1.0}; + HessianToScalar() {m_Alpha = 1.0;} ~HessianToScalar() {}; inline TOutput operator()( const TInput & Hessian ) { @@ -83,11 +83,11 @@ public: void SetAlpha(double Alpha) { - this->Functor().SetAlpha( Alpha ); + this->GetFunctor().SetAlpha( Alpha ); } double GetAlpha(void)const { - return( this->Functor().GetAlpha() ); + return( this->GetFunctor().GetAlpha() ); } protected: HessianToScalarImageFilter() {} diff --git a/Testing/Code/FeatureExtraction/CMakeLists.txt b/Testing/Code/FeatureExtraction/CMakeLists.txt index ddeef626ce03b7deda44dc9b945d08aaca9cef4f..12332cfb8ec42f75a7b14ab35b1d69b115e25f7a 100755 --- a/Testing/Code/FeatureExtraction/CMakeLists.txt +++ b/Testing/Code/FeatureExtraction/CMakeLists.txt @@ -142,7 +142,12 @@ ADD_TEST(feTuAssociativeSymmetricalSum ${FEATUREEXTRACTION_TESTS} ${TEMP}/feFiltreLineCorrelationLinear_poupees_2_3.hd ${TEMP}/feFiltreASS_poupees_2_3.hd) - +ADD_TEST(feTvHarrisImage ${FEATUREEXTRACTION_TESTS} + otbHarrisImage + ${INPUTDATA}/TeteAToto.png + ${TEMP}/feHarrisImage.png + 1.0 2.0 0.0) + #ADD_TEST(tvFEPatrick2 ${FEATUREEXTRACTION_TESTS} # --compare-image ${TOL} ${BASELINE}/otbExtractROI_cthead1_26_97_209_100.png # ${TEMP}/otbExtractROI_cthead1_26_97_209_100.png @@ -179,6 +184,7 @@ otbLineCorrelationDetectorLinear.cxx otbLineCorrelationDetector.cxx otbAssociativeSymmetricalSumNew.cxx otbAssociativeSymmetricalSum.cxx +otbHarrisImage.cxx ) diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx index 5eafb6258010815dc9ba1fb241a7078687b28523..594dd5a7e627da1c5a99cac080f608de50e3f902 100755 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests.cxx @@ -35,4 +35,5 @@ REGISTER_TEST(otbLineCorrelationDetectorLinear); REGISTER_TEST(otbLineCorrelationDetector); REGISTER_TEST(otbAssociativeSymmetricalSumNew); REGISTER_TEST(otbAssociativeSymmetricalSum); +REGISTER_TEST(otbHarrisImage); }