diff --git a/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.txx b/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.txx index 0f9b7b680ba817197df2e9791085bdc108d0bb9e..bccb8ec45ee827f3a0016597688c2b2586dd7fce 100644 --- a/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.txx +++ b/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.txx @@ -203,26 +203,22 @@ PersistentDescriptorsListSampleGenerator<TInputImage, TVectorData, TFunctionType labelListSample->SetMeasurementVectorSize(m_ThreadLabelListSample[0]->GetMeasurementVectorSize()); // Copy the first thread elements into lists - if( this->GetNumberOfThreads() > 1 ) + ListSampleType* threadListSample = m_ThreadListSample[0]; + LabelListSampleType* threadLabelListSample = m_ThreadLabelListSample[0]; + SamplesPositionType& threadSamplesPosition = m_ThreadSamplesPosition[0]; + for (unsigned int i = 0; i < threadListSample->Size(); ++i) { - ListSampleType* threadListSample = m_ThreadListSample[0]; - LabelListSampleType* threadLabelListSample = m_ThreadLabelListSample[0]; - SamplesPositionType& threadSamplesPosition = m_ThreadSamplesPosition[0]; - - for (unsigned int i = 0; i < threadListSample->Size(); ++i) - { - listSample->PushBack( threadListSample->GetMeasurementVector(i) ); - labelListSample->PushBack( threadLabelListSample->GetMeasurementVector(i) ); - samplesPosition.push_back( threadSamplesPosition[i] ); - } + listSample->PushBack( threadListSample->GetMeasurementVector(i) ); + labelListSample->PushBack( threadLabelListSample->GetMeasurementVector(i) ); + samplesPosition.push_back( threadSamplesPosition[i] ); } // Add the other thread element checking if the point dosn't already exist for (itk::ThreadIdType threadId = 1; threadId < this->GetNumberOfThreads(); ++threadId ) { - ListSampleType* threadListSample = m_ThreadListSample[threadId]; - LabelListSampleType* threadLabelListSample = m_ThreadLabelListSample[threadId]; - SamplesPositionType& threadSamplesPosition = m_ThreadSamplesPosition[threadId]; + threadListSample = m_ThreadListSample[threadId]; + threadLabelListSample = m_ThreadLabelListSample[threadId]; + threadSamplesPosition = m_ThreadSamplesPosition[threadId]; for (unsigned int i = 0; i < threadListSample->Size(); ++i) {