From 6d0b70d220a5eba0f5c398e6fc2edd6e15a07705 Mon Sep 17 00:00:00 2001
From: Julien Malik <julien.malik@c-s.fr>
Date: Fri, 19 Nov 2010 10:55:36 +0100
Subject: [PATCH] ENH: in ObjectDetectionClassifier, output points in physical
 coordinates

---
 Code/ObjectDetection/otbObjectDetectionClassifier.txx | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/Code/ObjectDetection/otbObjectDetectionClassifier.txx b/Code/ObjectDetection/otbObjectDetectionClassifier.txx
index 051a22f137..1c58ba1fa1 100644
--- a/Code/ObjectDetection/otbObjectDetectionClassifier.txx
+++ b/Code/ObjectDetection/otbObjectDetectionClassifier.txx
@@ -132,7 +132,7 @@ PersistentObjectDetectionClassifier<TInputImage,TOutputVectorData,TLabel,TFuncti
 {
   // merge all points in a single vector data
   //std::copy(m_ThreadPointArray[0].begin(), m_ThreadPointArray[0].end(),
-   //         std::ostream_iterator<DescriptorsFunctionPointType>(std::cout, "\n") );
+  //std::ostream_iterator<DescriptorsFunctionPointType>(std::cout, "\n") );
 
   VectorDataType* vdata = this->GetOutputVectorData();
 
@@ -231,15 +231,14 @@ PersistentObjectDetectionClassifier<TInputImage,TOutputVectorData,TLabel,TFuncti
 
 }
 
-
-
 template <class TInputImage, class TOutputVectorData, class TLabel, class TFunctionType>
 void
 PersistentObjectDetectionClassifier<TInputImage,TOutputVectorData,TLabel,TFunctionType>
 ::ThreadedGenerateData(const RegionType& outputRegionForThread,
                        int threadId)
 {
-  SVMModelType* model = static_cast<SVMModelType*>(this->itk::ProcessObject::GetInput(1));
+  InputImageType* input = static_cast<InputImageType*>(this->itk::ProcessObject::GetInput(0));
+  SVMModelType*   model = static_cast<SVMModelType*>(this->itk::ProcessObject::GetInput(1));
 
   typedef typename RegionType::IndexType      IndexType;
   typedef typename RegionType::IndexValueType IndexValueType;
@@ -272,7 +271,9 @@ PersistentObjectDetectionClassifier<TInputImage,TOutputVectorData,TLabel,TFuncti
 
           if (label != m_NoClassLabel)
             {
-            m_ThreadPointArray[threadId].push_back(std::make_pair(point, label));
+            DescriptorsFunctionPointType phyPoint;
+            input->TransformIndexToPhysicalPoint(current, phyPoint);
+            m_ThreadPointArray[threadId].push_back(std::make_pair(phyPoint, label));
             }
           }
         }
-- 
GitLab