diff --git a/Code/BasicFilters/otbCountImageFunction.h b/Code/BasicFilters/otbCountImageFunction.h
new file mode 100644
index 0000000000000000000000000000000000000000..4db9d0389cdfee49447e4d38a6650f15a4586d86
--- /dev/null
+++ b/Code/BasicFilters/otbCountImageFunction.h
@@ -0,0 +1,141 @@
+/*=========================================================================
+
+  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.
+
+=========================================================================*/
+#ifndef __otbCountImageFunction_h
+#define __otbCountImageFunction_h
+
+#include "itkImageFunction.h"
+#include "itkNumericTraits.h"
+#include "itkProcessObject.h"
+
+namespace otb
+{
+
+/**
+ * \class CountImageFunction
+ * \brief Calculate the density in the neighborhood of a pixel
+ *
+ *
+ * \ingroup ImageFunctions
+ */
+template <class TInputImage, class  TDetector, class  TCount >
+ class ITK_EXPORT CountImageFunction :
+  public itk::ImageFunction< TInputImage, typename itk::NumericTraits<typename TInputImage::PixelType>::RealType>
+{
+public:
+  /** Standard class typedefs. */
+  typedef CountImageFunction                  Self;
+  typedef itk::ImageFunction<TInputImage, typename itk::NumericTraits<typename TInputImage::PixelType>::RealType >      
+                                              Superclass;
+  typedef itk::SmartPointer<Self>             Pointer;
+  typedef itk::SmartPointer<const Self>       ConstPointer;
+  
+  /** Run-time type information (and related methods). */
+  itkTypeMacro(CountImageFunction, itk::ImageFunction);
+
+  /** Method for creation through the object factory. */
+  itkNewMacro(Self);
+
+  /** InputImageType typedef support. */
+  typedef TInputImage InputImageType;
+
+  /** Index typedef support. */
+  typedef typename Superclass::IndexType IndexType;
+  
+  /** ContinuousIndex typedef support. */
+  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
+
+  /** Point typedef support. */
+  typedef typename Superclass::PointType PointType;
+  
+  /** Datatype used for the density */
+  typedef typename itk::NumericTraits<typename InputImageType::PixelType>::RealType   RealType;
+
+  /** Detector typedef support*/
+  typedef TDetector                             DetectorType;
+  typedef typename DetectorType::Pointer        DetectorPointerType;
+
+  /** Count Method type*/
+  typedef TCount                             CountType; 
+  
+
+  /** Dimension of the underlying image. */
+  itkStaticConstMacro(ImageDimension, unsigned int,
+                      InputImageType::ImageDimension);
+
+
+
+  /** Evalulate the function at specified index */
+  virtual RealType EvaluateAtIndex( const IndexType& index );
+   virtual RealType EvaluateAtIndex( const IndexType& index ) const;
+  /** Evaluate the function at non-integer positions */
+  virtual RealType Evaluate( const PointType& point ) const
+    { 
+      IndexType index;
+      this->ConvertPointToNearestIndex( point, index );
+      return this->EvaluateAtIndex( index ); 
+    }
+  virtual RealType EvaluateAtContinuousIndex( 
+    const ContinuousIndexType& cindex ) const
+    { 
+      IndexType index;
+      this->ConvertContinuousIndexToNearestIndex( cindex, index );
+      return this->EvaluateAtIndex( index ) ; 
+    }
+
+  /**SetDetector */
+  virtual void SetDetector( DetectorType* detector) ;
+  
+  /**GetDetector */
+  virtual DetectorType * GetDetector() ;
+
+  /** Get/Set the radius of the neighborhood over which the
+      statistics are evaluated */
+  itkSetMacro( NeighborhoodRadius, unsigned int );
+  itkGetConstReferenceMacro( NeighborhoodRadius, unsigned int );
+ 
+protected:
+  CountImageFunction();
+  ~CountImageFunction(){};
+  
+  /**Update method*/
+  virtual void Modified();
+
+  void PrintSelf(std::ostream& os, itk::Indent indent) const;
+
+  
+
+private:
+  CountImageFunction( const Self& ); //purposely not implemented
+  void operator=( const Self& ); //purposely not implemented
+
+  /** Detector implementation */
+  DetectorPointerType m_Detector;
+
+  unsigned int m_NeighborhoodRadius;
+  bool m_HasBeenGenerated;
+};
+
+} // end namespace otb
+
+
+#ifndef OTB_MANUAL_INSTANTIATION 
+#include "otbCountImageFunction.txx"
+#endif
+
+#endif
+
diff --git a/Code/BasicFilters/otbCountImageFunction.txx b/Code/BasicFilters/otbCountImageFunction.txx
new file mode 100644
index 0000000000000000000000000000000000000000..975297ec9c6d6577820c5b2115a202f98292398e
--- /dev/null
+++ b/Code/BasicFilters/otbCountImageFunction.txx
@@ -0,0 +1,129 @@
+/*=========================================================================
+
+  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.
+
+=========================================================================*/
+#ifndef __otbCountImageFunction_txx
+#define __otbCountImageFunction_txx
+
+#include "otbCountImageFunction.h"
+
+#include "itkProcessObject.h"
+#include "itkNumericTraits.h"
+#include "itkConstNeighborhoodIterator.h"
+
+namespace otb
+{
+
+/**
+ * Constructor
+ */
+template <class TInputImage, class TDetector ,class TCount >
+CountImageFunction<TInputImage,TDetector , TCount>
+::CountImageFunction()
+{
+  m_NeighborhoodRadius = 1;
+  m_Detector = DetectorType::New();
+
+  m_HasBeenGenerated = false;
+}
+
+
+/**
+ *
+ */
+template <class TInputImage, class TDetector ,class TCount >
+void
+CountImageFunction< TInputImage, TDetector , TCount >
+::PrintSelf(std::ostream& os, itk::Indent indent) const
+{
+  this->Superclass::PrintSelf(os,indent);
+  os << indent << "NeighborhoodRadius: "  << m_NeighborhoodRadius << std::endl;
+}
+
+
+/**
+ *
+ */
+template <class TInputImage, class TDetector ,class TCount >
+typename CountImageFunction< TInputImage, TDetector , TCount >
+::RealType
+CountImageFunction<TInputImage,TDetector , TCount>
+::EvaluateAtIndex(const IndexType& index)
+{
+  // generate data again
+  if(!m_HasBeenGenerated)
+    {
+      m_Detector->SetInput(this->GetInputImage());
+      m_Detector->Update();
+      m_HasBeenGenerated = true;
+
+    }
+  // Call the const implementation
+  return this->EvaluateAtIndex(index);
+}
+
+template <class TInputImage, class TDetector ,class TCount >
+typename CountImageFunction< TInputImage, TDetector , TCount >
+::RealType
+CountImageFunction<TInputImage,TDetector , TCount>
+::EvaluateAtIndex(const IndexType& index) const
+{
+  CountType  countDensity;
+  return countDensity(m_Detector->GetOutput(),this->GetNeighborhoodRadius(),index );
+}
+
+/**
+ * SetDetector method
+ */
+template <class TInputImage, class TDetector ,class TCount >
+void
+CountImageFunction<TInputImage,TDetector , TCount>
+::SetDetector( DetectorType* detector)
+{
+  m_Detector = detector;
+}
+
+/**
+ * GetDetector method
+ */
+template <class TInputImage, class TDetector ,class TCount >
+typename CountImageFunction< TInputImage, TDetector , TCount >
+::DetectorType *
+CountImageFunction<TInputImage,TDetector , TCount>
+::GetDetector() 
+{
+  return m_Detector;
+}
+
+// /**
+//  * Modified
+//  */
+template <class TInputImage, class TDetector ,class TCount >
+void
+CountImageFunction<TInputImage,TDetector , TCount>
+::Modified()
+{
+  m_HasBeenGenerated = false ;
+  Superclass::Modified();
+  m_Detector->Modified();
+}
+
+
+
+
+} // end namespace otb
+
+#endif
diff --git a/Testing/Code/BasicFilters/CMakeLists.txt b/Testing/Code/BasicFilters/CMakeLists.txt
index 1f1c98ca473f404c777f29db51c023a7fc19a09f..63a0929ed4eec17be18a81d148e3035ed03e5c27 100644
--- a/Testing/Code/BasicFilters/CMakeLists.txt
+++ b/Testing/Code/BasicFilters/CMakeLists.txt
@@ -1115,6 +1115,11 @@ ADD_TEST(bfTvExtractROIResample2 ${BASICFILTERS_TESTS11}
 	 ${TEMP}/bfTvExtractROIResample2.tif
 	 1
 )
+# -------    otbCountImageFunction   ----------------------------
+ADD_TEST(bfTuCountImageFunctionNew ${BASICFILTERS_TESTS11}
+	 otbCountImageFunctionNew
+	 )
+
 
 
 # A enrichir
@@ -1277,6 +1282,7 @@ ENDIF(USE_FFTWD)
 
 SET(BasicFilters_SRCS11
 otbExtractROIResample.cxx
+otbCountImageFunctionNew.cxx
 )
 
 
@@ -1313,6 +1319,6 @@ ADD_EXECUTABLE(otbBasicFiltersTests10 otbBasicFiltersTests10.cxx ${BasicFilters_
 TARGET_LINK_LIBRARIES(otbBasicFiltersTests10  OTBBasicFilters  OTBIO )
 
 ADD_EXECUTABLE(otbBasicFiltersTests11 otbBasicFiltersTests11.cxx ${BasicFilters_SRCS11})
-TARGET_LINK_LIBRARIES(otbBasicFiltersTests11  OTBBasicFilters  OTBIO )
+TARGET_LINK_LIBRARIES(otbBasicFiltersTests11  OTBBasicFilters  OTBIO OTBFeatureExtraction)
 
 ENDIF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests11.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests11.cxx
index b92b25de997386b26c69c3e7f687d72eafb27133..aec76493c850a9430a7d2e969925763e785be544 100644
--- a/Testing/Code/BasicFilters/otbBasicFiltersTests11.cxx
+++ b/Testing/Code/BasicFilters/otbBasicFiltersTests11.cxx
@@ -27,5 +27,6 @@
 
 void RegisterTests()
 {
-  REGISTER_TEST(otbExtractROIResample);
+REGISTER_TEST(otbExtractROIResample);
+REGISTER_TEST(otbCountImageFunctionNew); 
 }
diff --git a/Testing/Code/BasicFilters/otbCountImageFunctionNew.cxx b/Testing/Code/BasicFilters/otbCountImageFunctionNew.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..1edc301a424ffa72f34428d26521b4a762f629c2
--- /dev/null
+++ b/Testing/Code/BasicFilters/otbCountImageFunctionNew.cxx
@@ -0,0 +1,50 @@
+/*=========================================================================
+
+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 "otbCountImageFunction.h"
+#include "otbSiftFastImageFilter.h"
+#include "otbSimplePointCountStrategy.h"
+#include "itkPointSet.h"
+#include "itkVariableLengthVector.h"
+#include "otbImage.h"
+
+int otbCountImageFunctionNew(int, char* [] )
+{
+
+  const   unsigned int                                      Dimension = 2;
+  typedef float                                             PixelType; 
+
+  typedef otb::Image< PixelType, Dimension >                ImageType;
+  typedef ImageType::IndexType                              IndexType;
+  typedef itk::VariableLengthVector<PixelType>              RealVectorType;
+  typedef itk::PointSet<RealVectorType,Dimension>           PointSetType;
+  typedef otb::SiftFastImageFilter<ImageType,PointSetType>  DetectorType;
+  
+  typedef otb::Count<PointSetType,unsigned int ,IndexType>  CounterType;
+  
+  typedef otb::CountImageFunction< ImageType,DetectorType,
+                                             CounterType>   FunctionType;
+  
+  /**Instancitation of an object*/
+  FunctionType::Pointer    filter =     FunctionType::New();
+
+  return EXIT_SUCCESS;
+}
+