diff --git a/Code/ObjectDetection/otbStandardMetaImageFunctionBuilder.h b/Code/ObjectDetection/otbStandardMetaImageFunctionBuilder.h
index e0c82adcd253c79d3444f299b2774ff27b2bce48..e52661cedb820dd9f5386d21b65ef1d7514df9a8 100644
--- a/Code/ObjectDetection/otbStandardMetaImageFunctionBuilder.h
+++ b/Code/ObjectDetection/otbStandardMetaImageFunctionBuilder.h
@@ -107,9 +107,10 @@ public:
   template <class TInputImage>
   void AddImage(TInputImage * image)
   {
-    typedef TInputImage                      InputImageType;
-    typedef Image<ValueType, 2>              ImageType;
-
+    typedef TInputImage                                   InputImageType;
+    typedef typename InputImageType::InternalPixelType    InternalPixelType;
+    typedef Image<InternalPixelType, 2>                   ImageType;
+   
     //Mono-Channel Factories
     typedef LocalHistogramIFFactory<ImageType,
       CoordRepType, TPrecision>               LocalHistogramIFFactoryType;