diff --git a/Applications/FeatureExtraction/otbEdgeExtraction.cxx b/Applications/FeatureExtraction/otbEdgeExtraction.cxx
index 36900fbd7e0d5b03b1d8736a80162cf1a5d86a73..5f409d775cc7336596651907f0aa20a9630215b7 100644
--- a/Applications/FeatureExtraction/otbEdgeExtraction.cxx
+++ b/Applications/FeatureExtraction/otbEdgeExtraction.cxx
@@ -130,8 +130,9 @@ void DoExecute()
 {
   FloatVectorImageType::Pointer inImage = GetParameterImage("in");
   inImage->UpdateOutputInformation();
+  int nbChan = inImage->GetNumberOfComponentsPerPixel();
 
-  if( GetParameterInt("channel") > inImage->GetNumberOfComponentsPerPixel() )
+  if( GetParameterInt("channel") > nbChan )
     {
     otbAppLogCRITICAL("Selected band is not available...");
     return;
diff --git a/Applications/FeatureExtraction/otbLocalStatisticExtraction.cxx b/Applications/FeatureExtraction/otbLocalStatisticExtraction.cxx
index 9488cc0fe8d7c483645895b750cc587ce5476f8d..457ca6fccb05dd30222e0319542b403d52744ab1 100644
--- a/Applications/FeatureExtraction/otbLocalStatisticExtraction.cxx
+++ b/Applications/FeatureExtraction/otbLocalStatisticExtraction.cxx
@@ -102,8 +102,9 @@ void DoExecute()
 {
   FloatVectorImageType::Pointer inImage = GetParameterImage("in");
   inImage->UpdateOutputInformation();
+  int nbChan = inImage->GetNumberOfComponentsPerPixel();
 
-  if( GetParameterInt("channel") > inImage->GetNumberOfComponentsPerPixel() )
+  if( GetParameterInt("channel") > nbChan )
     {
     otbAppLogCRITICAL("Selected band is not available...");
     return;