diff --git a/Code/Learning/otbSVMImageModelEstimator.txx b/Code/Learning/otbSVMImageModelEstimator.txx index d3f567c336d05b0ee26c7830a2540304694a893d..5f1162e0efb6b3de5d20040daac09cffb2c08203 100644 --- a/Code/Learning/otbSVMImageModelEstimator.txx +++ b/Code/Learning/otbSVMImageModelEstimator.txx @@ -148,6 +148,11 @@ SVMImageModelEstimator<TInputImage, TTrainingImage> + + //This works with Image< itk::Vector > and with VectorImage< scalar >. + unsigned int numberOfComponents = inIt.Get().Size(); + + otbMsgDevMacro( << " Before while " ); while(!inIt.IsAtEnd() && !trIt.IsAtEnd()) { @@ -158,7 +163,7 @@ SVMImageModelEstimator<TInputImage, TTrainingImage> typename Superclass::MeasurementVectorType v; - for(int k=0; k<inputImage->GetNumberOfComponentsPerPixel(); k++) + for(int k=0; k<numberOfComponents; k++) { v.push_back(inIt.Get()[k]); }